結果

問題 No.1852 Divide or Reduce
ユーザー 👑 KazunKazun
提出日時 2022-02-25 22:31:25
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 714 bytes
コンパイル時間 249 ms
コンパイル使用メモリ 86,964 KB
実行使用メモリ 136,800 KB
最終ジャッジ日時 2023-09-16 17:38:04
合計ジャッジ時間 6,475 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 108 ms
72,368 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 199 ms
120,916 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 207 ms
128,436 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 235 ms
107,016 KB
testcase_20 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

from functools import lru_cache

@lru_cache(maxsize=None)
def greedy(A):
    if not A:
        return False

    flag=False
    for i in range(len(A)):
        B=A[:i]+A[i+1:]
        for p in range(1,A[i]):
            flag|=not greedy(tuple(sorted(B+(p,A[i]-p))))

    if min(A)>=2:
        flag|=not(tuple([a-1 for a in A]))

    return flag

"""
while True:
    B=tuple(map(int,input().split()))
    print(greedy(B))
"""

import sys
input=sys.stdin.readline
write=sys.stdout.write

T=int(input())
Ans=[0]*T
for t in range(T):
    N=int(input())
    A=list(map(int,input().split()))

    X=0
    for a in A: X+=a-1

    if X%2==0:
        Ans[t]=1

write("\n".join(map(lambda x:"Second" if x else "First",Ans)))
0