๐๋ฌธ์ :


๐ํ์ด:
ํ ๋ผ์ธ์๋ ์ซ์๊ฐ 3๊ฐ๋ก ์ผ์ ํ๋ฏ๋ก, 3*2 ์ด์ฐจ์ ๋ฆฌ์คํธ๋ฅผ ์ด์ฉํ์ฌ,
๋ฐ๋ณต๋ฌธ์ ํ ๋ฒ๋ง ์ฌ์ฉํ์ฌ ์ต์๊ฐ๊ณผ ์ต๋๊ฐ์ ๊ณ์ ๊ฐฑ์ ํ๋ ๋ฐฉ๋ฒ์ ์ด์ฉํจ.
โ๏ธ์ฝ๋:
'''
https://www.acmicpc.net/problem/2096
๋ฌธ์ : ๋ด๋ ค๊ฐ๊ธฐ
๋์ด๋: ๊ณจ๋5
'''
import sys
line = int(sys.stdin.readline())
first, second, third = map(int, sys.stdin.readline().split())
last = [[first, first], [second, second], [third, third]] # ์ ค ์์ ๊ฐ๋ค์ ๋จผ์ ์ธํ
for _ in range(line-1):
a, b, c = map(int, sys.stdin.readline().split())
temp1 = a + min(last[0][0], last[1][0])
temp2 = a + max(last[0][1], last[1][1])
temp3 = b + min(last[0][0], last[1][0], last[2][0])
temp4 = b + max(last[0][1], last[1][1], last[2][1])
temp5 = c + min(last[1][0], last[2][0])
temp6 = c + max(last[1][1], last[2][1])
last = [[temp1, temp2], [temp3, temp4], [temp5, temp6]]
print(max(last[0][1], last[1][1], last[2][1]), min(last[0][0], last[1][0], last[2][0]))
๐๋งํฌ:
'๐งฉps > ๐ฅNormal' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[๋ฐฑ์ค 18115๋ฒ] ์์ด๊ณผ ์ฟผ๋ฆฌ 38 (0) | 2024.10.01 |
---|---|
[๋ฐฑ์ค 1654๋ฒ] ๋์ ์๋ฅด๊ธฐ (0) | 2024.09.29 |
[๋ฐฑ์ค 2108๋ฒ] ํต๊ณํ (0) | 2024.09.28 |
[๋ฐฑ์ค 1874๋ฒ] ์คํ ์์ด (0) | 2024.09.27 |
[๋ฐฑ์ค 1966๋ฒ] ํ๋ฆฐํฐ ํ (0) | 2024.09.26 |