結果
| 問題 |
No.26 シャッフルゲーム
|
| コンテスト | |
| ユーザー |
steek79
|
| 提出日時 | 2015-10-14 23:31:20 |
| 言語 | Python2 (2.7.18) |
| 結果 |
AC
|
| 実行時間 | 12 ms / 5,000 ms |
| コード長 | 321 bytes |
| コンパイル時間 | 156 ms |
| コンパイル使用メモリ | 7,072 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-21 15:57:53 |
| 合計ジャッジ時間 | 788 ms |
|
ジャッジサーバー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