結果

問題 No.26 シャッフルゲーム
ユーザー _KingdomOfMoray
提出日時 2019-12-01 11:17:17
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 32 ms / 5,000 ms
コード長 403 bytes
コンパイル時間 295 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-11-21 04:29:32
合計ジャッジ時間 1,560 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
m = int(input())
first = []
second = []
swaplist = []
for i in range(m):
    first, second = [int(i) for i in input().split()]
    curlist = [first, second]
    swaplist.append(curlist)

cup = [0] * 3
cup[n-1] = 1

for i in range(m):
    buf = cup[swaplist[i][1]-1]
    cup[swaplist[i][1]-1] = cup[swaplist[i][0]-1]
    cup[swaplist[i][0]-1] = buf
    
res = cup.index(1) + 1
print(res)
0