結果

問題 No.429 CupShuffle
ユーザー rocoderrocoder
提出日時 2017-08-02 15:58:46
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 505 bytes
コンパイル時間 107 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 18,208 KB
最終ジャッジ日時 2024-04-19 13:31:25
合計ジャッジ時間 4,248 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 TLE -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#cup
N,K,X=(int(i) for i in input().split())
A=[[i for i in input().split()] for i in range(K)]
C=[int(i) for i in input().split()]
S=[0]*N
for i in range(N):
    S[i]=i+1
i=0
while i<K and A[i][0]!="?":
    a1=int(A[i][0])+1
    b=int(A[i][1])+1
    t=S[a1]
    S[a1]=S[b]
    S[b]=t
    i+=1
i=K-1
while i>=0 and A[i][0]!="?":
    a1=int(A[i][0])+1
    b=int(A[i][1])+1
    t=C[a1]
    C[a1]=C[b]
    C[b]=t
    i-=1
i=0
cp=""
while i<N and len(cp)<3:
    if S[i]!=C[i]:
        cp+=str(i)+" "
print(cp)
0