結果
問題 | No.429 CupShuffle |
ユーザー | 💕💖💞 |
提出日時 | 2017-01-28 19:49:22 |
言語 | Python3 (3.11.6 + numpy 1.26.0 + scipy 1.11.3) |
結果 |
AC
|
実行時間 | 510 ms / 2,000 ms |
コード長 | 672 bytes |
コンパイル時間 | 343 ms |
コンパイル使用メモリ | 10,856 KB |
実行使用メモリ | 57,960 KB |
最終ジャッジ日時 | 2023-08-25 13:24:34 |
合計ジャッジ時間 | 3,692 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge12 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 16 ms
8,372 KB |
testcase_01 | AC | 13 ms
8,188 KB |
testcase_02 | AC | 13 ms
8,280 KB |
testcase_03 | AC | 13 ms
8,196 KB |
testcase_04 | AC | 16 ms
8,476 KB |
testcase_05 | AC | 16 ms
8,140 KB |
testcase_06 | AC | 15 ms
8,532 KB |
testcase_07 | AC | 16 ms
8,376 KB |
testcase_08 | AC | 13 ms
7,832 KB |
testcase_09 | AC | 15 ms
8,484 KB |
testcase_10 | AC | 53 ms
13,012 KB |
testcase_11 | AC | 510 ms
57,960 KB |
testcase_12 | AC | 482 ms
57,876 KB |
testcase_13 | AC | 497 ms
57,428 KB |
testcase_14 | AC | 500 ms
57,352 KB |
testcase_15 | AC | 15 ms
8,212 KB |
ソースコード
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))))))))