結果
| 問題 | No.429 CupShuffle | 
| コンテスト | |
| ユーザー |  maspy | 
| 提出日時 | 2020-02-02 11:59:05 | 
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 275 ms / 2,000 ms | 
| コード長 | 600 bytes | 
| コンパイル時間 | 112 ms | 
| コンパイル使用メモリ | 12,544 KB | 
| 実行使用メモリ | 34,168 KB | 
| 最終ジャッジ日時 | 2024-09-18 20:34:53 | 
| 合計ジャッジ時間 | 2,605 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 16 | 
ソースコード
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import itertools
N,K,X = map(int,readline().split())
AB1 = list(tuple(map(int,readline().split())) for _ in range(X-1))
readline()
AB2 = list(tuple(map(int,readline().split())) for _ in range(K-X))
*C, = map(int,read().split())
before = list(range(N+1))
after = [0] + C
for a,b in AB1:
    before[a], before[b] = before[b], before[a]
for a,b in AB2[::-1]:
    after[a], after[b] = after[b], after[a]
diff = [i for i,(x,y) in enumerate(zip(before, after)) if x != y]
print(*diff)
            
            
            
        