結果
| 問題 | No.26 シャッフルゲーム |
| コンテスト | |
| ユーザー |
steek79
|
| 提出日時 | 2015-10-14 23:31:20 |
| 言語 | PyPy2 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 74 ms / 5,000 ms |
| コード長 | 321 bytes |
| 記録 | |
| コンパイル時間 | 153 ms |
| コンパイル使用メモリ | 77,376 KB |
| 最終ジャッジ日時 | 2025-12-03 17:32:56 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 |
ソースコード
N = input()
M = input()
cups = [0] * 3
cups[N-1] = 1
def move_cups(cups, p, q):
if cups[p-1] + cups[q-1] > 0:
cups[p-1] = (cups[p-1]+1) %2 # 0<->1
cups[q-1] = (cups[q-1]+1) %2 # 1<->0
for m in range(M):
p, q = map(int, raw_input().split())
move_cups(cups, p, q)
print cups.index(1)+1
steek79