結果

問題 No.1208 anti primenumber game
ユーザー lam6er
提出日時 2025-03-31 17:21:02
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,009 bytes
コンパイル時間 238 ms
コンパイル使用メモリ 82,600 KB
実行使用メモリ 122,476 KB
最終ジャッジ日時 2025-03-31 17:22:21
合計ジャッジ時間 5,977 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 33 WA * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    import sys
    input = sys.stdin.read().split()
    idx = 0
    N = int(input[idx])
    idx += 1
    M = int(input[idx])
    idx += 1
    A = list(map(int, input[idx:idx + N]))
    idx += N

    current_start = True  # True is First player's turn, False is Second
    total_diff = 0

    for a in A:
        if a == 1:
            diff = 1 - M
            move_count = 1
        else:
            case1 = a - M
            case2 = (a - 2) + M
            if case1 >= case2:
                diff = case1
                move_count = 1
            else:
                diff = case2
                move_count = 2
        # Update total_diff based on current_start
        if current_start:
            total_diff += diff
        else:
            total_diff -= diff
        # Update current_start
        if move_count % 2 == 1:
            current_start = not current_start

    if total_diff > 0:
        print("First")
    else:
        print("Second")

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