結果

問題 No.429 CupShuffle
ユーザー matsu7874matsu7874
提出日時 2016-10-02 22:35:28
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 416 ms / 2,000 ms
コード長 455 bytes
コンパイル時間 271 ms
コンパイル使用メモリ 10,796 KB
実行使用メモリ 33,044 KB
最終ジャッジ日時 2023-08-13 17:05:26
合計ジャッジ時間 3,017 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
8,344 KB
testcase_01 AC 15 ms
7,724 KB
testcase_02 AC 15 ms
7,800 KB
testcase_03 AC 15 ms
7,788 KB
testcase_04 AC 17 ms
7,816 KB
testcase_05 AC 15 ms
7,748 KB
testcase_06 AC 19 ms
8,340 KB
testcase_07 AC 18 ms
8,208 KB
testcase_08 AC 16 ms
7,868 KB
testcase_09 AC 19 ms
7,804 KB
testcase_10 AC 53 ms
10,656 KB
testcase_11 AC 416 ms
33,012 KB
testcase_12 AC 387 ms
33,028 KB
testcase_13 AC 404 ms
33,044 KB
testcase_14 AC 413 ms
32,960 KB
testcase_15 AC 15 ms
7,748 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,k,x = map(int, input().split())
p = [[],[]]
t = 0
for i in range(k):
    if i+1 != x:
        a,b = map(int, input().split())
        p[t].append((a-1,b-1)) 
    else:
        _ = input()
        t = 1
c = list(map(int, input().split()))
a = [i+1 for i in range(n)]
for x,y in p[0]:
    a[x],a[y] = a[y],a[x]

for x,y in p[1][::-1]:
    c[x],c[y] = c[y],c[x]
ans = []
for i in range(n):
    if a[i] != c[i]:
        ans.append(i+1)
print(ans[0], ans[1])
0