結果

問題 No.429 CupShuffle
ユーザー rocoderrocoder
提出日時 2017-08-02 16:38:05
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 532 bytes
コンパイル時間 106 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 40,632 KB
最終ジャッジ日時 2024-04-19 13:31:30
合計ジャッジ時間 2,873 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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
  #  print (a1)
    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+1)+" "
    i+=1
print(cp)
0