結果

問題 No.429 CupShuffle
ユーザー htkbhtkb
提出日時 2018-05-26 10:56:11
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 297 ms / 2,000 ms
コード長 560 bytes
コンパイル時間 900 ms
コンパイル使用メモリ 10,800 KB
実行使用メモリ 44,600 KB
最終ジャッジ日時 2023-09-11 03:35:36
合計ジャッジ時間 3,759 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
8,284 KB
testcase_01 AC 17 ms
7,844 KB
testcase_02 AC 17 ms
7,804 KB
testcase_03 AC 16 ms
7,840 KB
testcase_04 AC 17 ms
8,316 KB
testcase_05 AC 15 ms
7,760 KB
testcase_06 AC 17 ms
8,352 KB
testcase_07 AC 18 ms
8,324 KB
testcase_08 AC 16 ms
7,844 KB
testcase_09 AC 17 ms
8,316 KB
testcase_10 AC 40 ms
11,796 KB
testcase_11 AC 288 ms
44,580 KB
testcase_12 AC 255 ms
44,484 KB
testcase_13 AC 281 ms
44,600 KB
testcase_14 AC 297 ms
43,924 KB
testcase_15 AC 15 ms
7,848 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
N, K, X = map(int, input().split())
rl = sys.stdin.readlines()
a1, a2 = [], []
for i, l in enumerate(rl):
    if l.startswith("?"):
        break
    a1.append(tuple(map(int, l.split())))
for l in rl[i+1:-1]:
    a2.append(tuple(map(int, l.split())))

l1, l2 = list(map(str, range(N+1))), ["0"]+list(rl[-1].split())
    
for x, y in a1:
    l1[x], l1[y] = l1[y], l1[x]
for x, y in a2[::-1]:
    l2[x], l2[y] = l2[y], l2[x]

result = []
for i, x, y in zip(range(N+1), l1, l2):
    if x != y:
        result.append(i)
print(" ".join(map(str, result)))
0