結果

問題 No.429 CupShuffle
ユーザー bauer24bauer24
提出日時 2017-02-28 15:02:51
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 486 ms / 2,000 ms
コード長 589 bytes
コンパイル時間 171 ms
コンパイル使用メモリ 10,980 KB
実行使用メモリ 38,408 KB
最終ジャッジ日時 2023-09-02 16:25:36
合計ジャッジ時間 3,899 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
8,168 KB
testcase_01 AC 16 ms
7,888 KB
testcase_02 AC 16 ms
7,736 KB
testcase_03 AC 16 ms
7,744 KB
testcase_04 AC 18 ms
7,768 KB
testcase_05 AC 16 ms
7,868 KB
testcase_06 AC 20 ms
8,144 KB
testcase_07 AC 20 ms
8,196 KB
testcase_08 AC 16 ms
7,808 KB
testcase_09 AC 19 ms
7,852 KB
testcase_10 AC 56 ms
10,504 KB
testcase_11 AC 471 ms
34,956 KB
testcase_12 AC 416 ms
32,648 KB
testcase_13 AC 486 ms
38,408 KB
testcase_14 AC 413 ms
23,436 KB
testcase_15 AC 16 ms
7,828 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K,X = [int(i) for i in input().split()]
cups = []
for i in range(N):
    cups.append(i+1)

for i in range(X-1):
    s1,s2 = [int(i) for i in input().split()]
    cups[s1-1],cups[s2-1] = cups[s2-1],cups[s1-1]

s1,s2 = [str(i) for i in input().split()]
box = []
for i in range(K-X):
    s = [int(i) for i in input().split()]
    box.append(s)
last = [int(i) for i in input().split()]
for i in range(K-X):
    s1,s2 = box[K-X-1-i][0],box[K-X-1-i][1]
    last[s1-1],last[s2-1] = last[s2-1],last[s1-1]
ans = []
for i in range(N):
    if cups[i] != last[i]:
        ans.append(i+1)
print(*ans)
0