結果
問題 |
No.1208 anti primenumber game
|
ユーザー |
![]() |
提出日時 | 2021-02-11 22:30:22 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 854 bytes |
コンパイル時間 | 177 ms |
コンパイル使用メモリ | 81,984 KB |
実行使用メモリ | 115,400 KB |
最終ジャッジ日時 | 2024-07-18 09:48:28 |
合計ジャッジ時間 | 5,584 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 35 WA * 9 |
ソースコード
N, M = map(int, input().split()) A = list(map(int, input().split())) """ A = 1:取るしかない +1-M 手番が相手に = x:1残し +x-1 次も自分 ぜんぶとる +x-M 手番が相手に 1が連続してるとこは圧縮できる """ B = [] for a in A: if a == 1 and B and B[-1] == 1: B.pop() continue B.append(a) if not B: print("Second") exit() def game(B, i): X, Y = 0, 0 while i < len(B): b = B[i] if i + 1 < len(B) and B[i + 1] == 1: X += b - M Y += 1 - M i += 2 else: X += b - 1 Y += 1 - M i += 1 return X, Y X = 0 Y = 0 if B and B[0] == 1: X = 1 - M Q, P = game(B, 1) else: P, Q = game(B, 1) X += P Y += Q if X > Y: print("First") else: print("Second")