結果

問題 No.429 CupShuffle
ユーザー rin204
提出日時 2020-08-19 23:14:25
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 507 ms / 2,000 ms
コード長 536 bytes
コンパイル時間 136 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 47,316 KB
最終ジャッジ日時 2024-10-12 08:45:44
合計ジャッジ時間 3,289 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

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