結果

問題 No.429 CupShuffle
ユーザー yaoshimaxyaoshimax
提出日時 2016-10-02 22:55:49
言語 Python2
(2.7.18)
結果
AC  
実行時間 386 ms / 2,000 ms
コード長 501 bytes
コンパイル時間 111 ms
コンパイル使用メモリ 6,660 KB
実行使用メモリ 33,180 KB
最終ジャッジ日時 2023-08-13 17:16:24
合計ジャッジ時間 2,441 ms
ジャッジサーバーID
(参考情報)
judge13 / judge10
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
6,004 KB
testcase_01 AC 9 ms
5,872 KB
testcase_02 AC 8 ms
5,976 KB
testcase_03 AC 9 ms
5,960 KB
testcase_04 AC 11 ms
6,056 KB
testcase_05 AC 9 ms
6,116 KB
testcase_06 AC 14 ms
6,164 KB
testcase_07 AC 13 ms
6,036 KB
testcase_08 AC 9 ms
5,944 KB
testcase_09 AC 12 ms
5,932 KB
testcase_10 AC 43 ms
8,024 KB
testcase_11 AC 386 ms
30,888 KB
testcase_12 AC 346 ms
29,760 KB
testcase_13 AC 377 ms
33,180 KB
testcase_14 AC 331 ms
21,552 KB
testcase_15 AC 9 ms
5,920 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K,X=map(int,raw_input().split())
B=[i for i in range(N+1)]
flag=False
Crot=[]
for i in range(K):
    p,q=raw_input().split()
    if p=='?':
        flag = True
    elif flag==False:
       a,b=int(p),int(q)
       B[a],B[b]=B[b],B[a]
    else:
        a,b=int(p),int(q)
        Crot.append((int(a),int(b)))
Crot.reverse()
C=map(int,raw_input().split())
C=[0]+C
for a,b in Crot:
    C[a],C[b]=C[b],C[a]
#print C
#print B
ans=[]
for i,(p,q) in enumerate(zip(C,B)):
    if p!=q:
        print i,
print
0