結果

問題 No.429 CupShuffle
ユーザー 👑 rin204rin204
提出日時 2020-08-19 23:14:25
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 462 ms / 2,000 ms
コード長 536 bytes
コンパイル時間 206 ms
コンパイル使用メモリ 12,928 KB
実行使用メモリ 47,380 KB
最終ジャッジ日時 2024-04-20 13:19:44
合計ジャッジ時間 3,034 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,880 KB
testcase_01 AC 27 ms
10,752 KB
testcase_02 AC 26 ms
10,752 KB
testcase_03 AC 27 ms
10,752 KB
testcase_04 AC 28 ms
10,880 KB
testcase_05 AC 27 ms
10,752 KB
testcase_06 AC 30 ms
11,008 KB
testcase_07 AC 30 ms
11,136 KB
testcase_08 AC 27 ms
10,880 KB
testcase_09 AC 30 ms
10,880 KB
testcase_10 AC 65 ms
14,208 KB
testcase_11 AC 458 ms
47,044 KB
testcase_12 AC 437 ms
45,996 KB
testcase_13 AC 453 ms
47,312 KB
testcase_14 AC 462 ms
47,380 KB
testcase_15 AC 28 ms
10,752 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, k, x = map(int, input().split())
place = [i + 1 for i in range(n)]
ab = [input().split() for _ in range(k)]
for a, b in ab:
    if a == "?":
        break
    a, b = int(a) - 1, int(b) - 1
    place[a], place[b] = place[b], place[a]
clst = list(map(int, input().split()))
for a, b in ab[::-1]:
    if a == "?":
        break
    a, b = int(a) - 1, int(b) - 1
    clst[a], clst[b] = clst[b], clst[a]

ans = []
for i, (bef, aft) in enumerate(zip(place, clst), start = 1):
    if bef != aft:
        ans.append(i)
ans.sort()
print(*ans)
0