結果

問題 No.1852 Divide or Reduce
ユーザー LyricalMaestroLyricalMaestro
提出日時 2024-01-07 13:11:29
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 982 bytes
コンパイル時間 297 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 134,388 KB
最終ジャッジ日時 2024-01-07 13:11:46
合計ジャッジ時間 9,146 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,460 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 226 ms
122,932 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 238 ms
107,040 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 334 ms
102,956 KB
testcase_20 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

## https://yukicoder.me/problems/no/1852

def solve(N, A):
    A.sort()
    if A[0] == 1:
        ans = 0
        for i in range(1, N):
            if A[i] % 2 == 0:
                ans ^= 1
    else:
        odds = 0
        evens = 0
        for i in range(N):
            if A[i] % 2 == 0:
                evens += 1
            else:
                odds += 1
        if evens % 2 == 1:
            ans = 1
        elif odds % 2 == 1:
            ans = 0
        else:
            ans = 0
            for i in range(1, N):
                b = A[i] - (A[0] - 1)
                if b % 2 == 0:
                    ans ^= 1
    if ans == 1:
        return "First"
    else:
        return "Second"
            

def main():
    T = int(input())
    answers = []
    for _ in range(T):
        N = int(input())
        A = list(map(int, input().split()))
        answers.append(solve(N, A))

    for answer in answers:
        print(answer)




if __name__ == "__main__":
    main()
0