結果

問題 No.1208 anti primenumber game
ユーザー lam6er
提出日時 2025-04-15 22:00:41
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,322 bytes
コンパイル時間 439 ms
コンパイル使用メモリ 81,904 KB
実行使用メモリ 122,016 KB
最終ジャッジ日時 2025-04-15 22:01:54
合計ジャッジ時間 5,253 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 32 WA * 12
権限があれば一括ダウンロードができます

ソースコード

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]))
    
    sum_score = 0
    current_turn = True  # True for First player's turn
    
    for a in A:
        if current_turn:
            if a == 1:
                val = 1 - M
                sum_score += val
                current_turn = False
            else:
                option1 = a - M
                option2 = a + M - 2
                if option1 >= option2:
                    sum_score += option1
                    current_turn = False
                else:
                    sum_score += option2
                    # turn remains True
        else:
            if a == 1:
                val = -(1 - M)
                sum_score += val
                current_turn = True
            else:
                option1 = -(a - M)
                option2 = -(a + M - 2)
                if option1 >= option2:
                    sum_score += option1
                    current_turn = True
                else:
                    sum_score += option2
                    # turn remains False
    
    if sum_score > 0:
        print("First")
    else:
        print("Second")

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