結果

問題 No.715 集合と二人ゲーム
ユーザー gew1fw
提出日時 2025-06-12 15:10:50
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 819 bytes
コンパイル時間 249 ms
コンパイル使用メモリ 82,232 KB
実行使用メモリ 171,192 KB
最終ジャッジ日時 2025-06-12 15:11:16
合計ジャッジ時間 6,595 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 31 WA * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    import sys
    input = sys.stdin.read().split()
    N = int(input[0])
    A = list(map(int, input[1:N+1]))
    A.sort()
    
    groups = []
    if N == 0:
        print("Second")
        return
    current = A[0]
    count = 1
    for i in range(1, N):
        if A[i] == A[i-1] + 1:
            count += 1
        else:
            groups.append(count)
            current = A[i]
            count = 1
    groups.append(count)
    
    xor = 0
    for m in groups:
        if m == 0:
            continue
        if m == 1:
            xor ^= 1
        elif m == 2:
            xor ^= 1
        else:
            idx = (m - 3) % 5
            g = [2, 0, 3, 1, 1][idx]
            xor ^= g
    if xor != 0:
        print("First")
    else:
        print("Second")

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