結果

問題 No.429 CupShuffle
ユーザー pluto77pluto77
提出日時 2016-10-06 09:56:50
言語 Python2
(2.7.18)
結果
AC  
実行時間 409 ms / 2,000 ms
コード長 461 bytes
コンパイル時間 48 ms
コンパイル使用メモリ 6,940 KB
実行使用メモリ 47,360 KB
最終ジャッジ日時 2024-05-01 13:29:10
合計ジャッジ時間 2,555 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
6,812 KB
testcase_01 AC 9 ms
6,944 KB
testcase_02 AC 10 ms
6,944 KB
testcase_03 AC 10 ms
6,940 KB
testcase_04 AC 11 ms
6,940 KB
testcase_05 AC 10 ms
6,944 KB
testcase_06 AC 12 ms
6,940 KB
testcase_07 AC 13 ms
6,944 KB
testcase_08 AC 10 ms
6,940 KB
testcase_09 AC 12 ms
6,944 KB
testcase_10 AC 42 ms
10,368 KB
testcase_11 AC 409 ms
47,236 KB
testcase_12 AC 381 ms
47,228 KB
testcase_13 AC 398 ms
47,236 KB
testcase_14 AC 397 ms
47,360 KB
testcase_15 AC 9 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#yuki_429

n,k,x=map(int,raw_input().split())
s=[int(i) for i in xrange(n+1)]
r=[raw_input().split() for i in xrange(k)]
c=map(int,raw_input().split())
c.insert(0,0)
for i in xrange(len(r)):
 if r[i][0]=='?':
  break
 a,b=int(r[i][0]),int(r[i][1])
 s[a],s[b]=s[b],s[a]
for i in xrange(len(r)-1,-1,-1):
 if r[i][0]=='?':
  break
 a,b=int(r[i][0]),int(r[i][1])
 c[a],c[b]=c[b],c[a]
res=[]
for i in xrange(n+1):
 if s[i]!=c[i]:
  res.append(i)
print res[0],res[1]
0