結果

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

ソースコード

diff #

def main():
    import sys
    input = sys.stdin.read().split()
    n = int(input[0])
    a = list(map(int, input[1:n+1]))
    a.sort()
    
    clusters = []
    if not a:
        print("Second")
        return
    
    current_start = a[0]
    current_end = a[0]
    
    for num in a[1:]:
        if num == current_end + 1:
            current_end = num
        else:
            clusters.append((current_start, current_end))
            current_start = num
            current_end = num
    clusters.append((current_start, current_end))
    
    count_odd = 0
    for (s, e) in clusters:
        size = e - s + 1
        if size % 2 == 1:
            count_odd += 1
    
    if count_odd % 2 == 1:
        print("First")
    else:
        print("Second")

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