結果

問題 No.429 CupShuffle
ユーザー gahougahou
提出日時 2016-10-28 17:43:11
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 605 bytes
コンパイル時間 261 ms
コンパイル使用メモリ 7,136 KB
実行使用メモリ 34,320 KB
最終ジャッジ日時 2023-08-15 20:40:01
合計ジャッジ時間 2,999 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
5,928 KB
testcase_01 AC 9 ms
5,972 KB
testcase_02 AC 10 ms
5,940 KB
testcase_03 WA -
testcase_04 AC 11 ms
5,976 KB
testcase_05 AC 9 ms
5,884 KB
testcase_06 AC 12 ms
5,976 KB
testcase_07 AC 12 ms
6,124 KB
testcase_08 AC 8 ms
5,884 KB
testcase_09 AC 11 ms
5,920 KB
testcase_10 AC 48 ms
8,620 KB
testcase_11 WA -
testcase_12 AC 374 ms
34,304 KB
testcase_13 AC 407 ms
34,276 KB
testcase_14 AC 368 ms
34,220 KB
testcase_15 AC 9 ms
5,992 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K,X = map(int, raw_input().split())
l1 = [0] * N
for i in xrange(1, N+1): l1[i-1] = i
b=[]
a=[]
for i in xrange(1, K+1):
  A,B=raw_input().split()
  if i<X:
    b.append([int(A)-1, int(B)-1])
  elif X<i:
    a.append([int(A)-1, int(B)-1])
l2 = map(int, raw_input().split())

for i in xrange(len(b)):
  tmp = l1[b[i][0]]
  l1[b[i][0]] = l1[b[i][1]]
  l1[b[i][1]] = tmp
for i in xrange(len(a)):
  tmp = l2[a[len(a)-1-i][0]]
  l2[a[len(a)-1-i][0]] = l2[a[len(a)-1-i][1]]
  l2[a[len(a)-1-i][1]] = tmp
ans = []
for i in xrange(len(l1)):
  if(l1[i]!=l2[i]): ans.append(str(i+1))
ans.sort()
print " ".join(ans)
0