結果
| 問題 |
No.429 CupShuffle
|
| コンテスト | |
| ユーザー |
💕💖💞
|
| 提出日時 | 2017-01-28 19:49:22 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 570 ms / 2,000 ms |
| コード長 | 672 bytes |
| コンパイル時間 | 344 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 58,304 KB |
| 最終ジャッジ日時 | 2024-12-23 21:23:42 |
| 合計ジャッジ時間 | 4,340 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 16 |
ソースコード
N, K, X = map(int, input().split() )
ops = [list(input().split()) for _ in range(K)]
result = list(map(lambda x:int(x)-1, input().split()) )
heads = list(map(lambda x:list(map(lambda x2:int(x2)-1,x)), ops[:X-1]))
tails = list(map(lambda x:list(map(lambda x2:int(x2)-1,x)), reversed(ops[X:])) )
def swapper(target:list, op:list) -> None:
target[op[0]], target[op[1]] = target[op[1]], target[op[0]]
target = [i for i in range(N)]
[swapper(target, op) for op in heads]
[swapper(result, op) for op in tails]
print(' '.join(list(map(lambda x:str(x+1), filter(lambda x:x is not None, map(lambda x2:x2[2] if x2[0] != x2[1] else None, zip(target, result, range(N))))))))
💕💖💞