ps:problems:boj:33392
목차
Simple Game
ps | |
---|---|
링크 | acmicpc.net/… |
출처 | BOJ |
문제 번호 | 33392 |
문제명 | Simple Game |
레벨 | 플래티넘 5 |
분류 |
게임 이론 |
시간복잡도 | O(T*n) |
인풋사이즈 | T*n <= 250000 |
사용한 언어 | Python 3.13 |
제출기록 | 48640KB / 220ms |
최고기록 | 220ms |
해결날짜 | 2025/08/21 |
풀이
물고기 게임와 동일한 세팅의 문제이다. 풀이는 그쪽을 참고.
코드
"""Solution code for "BOJ 33392. Simple Game".
- Problem link: https://www.acmicpc.net/problem/33392
- Solution link: http://www.teferi.net/ps/problems/boj/33392
Tags: [game theory]
"""
import sys
from teflib import psutils
@psutils.run_n_times
def main():
n = int(sys.stdin.readline())
a1 = [int(x) for x in sys.stdin.readline().split()]
a2 = [int(x) for x in sys.stdin.readline().split()]
if n % 2 == 1:
score1 = sum(a1[: n // 2]) + sum(a2[: n // 2])
score2 = min(sum(a1), score1 + a1[n // 2] + a2[n // 2])
print(max(score1, score2))
else:
score1 = sum(a1[: n // 2]) + sum(a2[: n // 2])
score2a = max(score1, sum(a1))
score2b = score1 + a1[n // 2] + a2[n // 2]
score2 = min(score2a, score2b)
print(max(score1, score2))
if __name__ == '__main__':
main()
ps/problems/boj/33392.txt · 마지막으로 수정됨: 2025/08/21 05:14 저자 teferi
토론