| ps | |
|---|---|
| 링크 | acmicpc.net/… |
| 출처 | BOJ |
| 문제 번호 | 34130 |
| 문제명 | Yet Another Stone Game |
| 레벨 | 플래티넘 3 |
| 분류 |
게임 이론 |
| 시간복잡도 | O(T*n) |
| 인풋사이즈 | T*n <= 300000 |
| 사용한 언어 | Python 3.13 |
| 제출기록 | 66624KB / 220ms |
| 최고기록 | 220ms |
| 해결날짜 | 2025/08/21 |
"""Solution code for "BOJ 34130. Yet Another Stone Game".
- Problem link: https://www.acmicpc.net/problem/34130
- Solution link: http://www.teferi.net/ps/problems/boj/34130
Tags: [game theory]
"""
import sys
from teflib import psutils
@psutils.run_n_times
def main():
N, K = [int(x) for x in sys.stdin.readline().split()]
a = [int(x) for x in sys.stdin.readline().split()]
odd_count = sum(1 for a_i in a if a_i % 2 == 1)
if K == 1:
print('First' if sum(a) % 2 == 1 else 'Second')
elif odd_count == 0:
print('Second')
elif odd_count <= K:
print('First')
elif odd_count == N == K + 1:
print('Second')
elif odd_count + 1 == N == K + 2:
print('Second' if min(a) % 2 == 0 else 'First')
elif odd_count == N == K + 2:
print('First')
if __name__ == '__main__':
main()