ps | |
---|---|
링크 | acmicpc.net/… |
출처 | BOJ |
문제 번호 | 8055 |
문제명 | Polygons |
레벨 | 실버 3 |
분류 |
게임이론 |
시간복잡도 | O(1) |
사용한 언어 | Python 3.11 |
제출기록 | 31120KB / 40ms |
최고기록 | 40ms |
해결날짜 | 2023/12/15 |
"""Solution code for "BOJ 8055. Polygons".
- Problem link: https://www.acmicpc.net/problem/8055
- Solution link: http://www.teferi.net/ps/problems/boj/8055
Tags: [game theory]
"""
import sys
def is_outer_edge(x, y, n):
return abs(x - y) in (1, n - 1)
def main():
n = int(sys.stdin.readline())
a, b, c = [int(x) for x in sys.stdin.readline().split()]
if (
sum(1 for x, y in ((a, b), (b, c), (c, a)) if is_outer_edge(x, y, n))
== 2
):
print('TAK')
else:
print('TAK' if n % 2 == 0 else 'NIE')
if __name__ == '__main__':
main()