結果

問題 No.429 CupShuffle
ユーザー gahougahou
提出日時 2016-10-28 17:44:14
言語 Python2
(2.7.18)
結果
AC  
実行時間 512 ms / 2,000 ms
コード長 594 bytes
コンパイル時間 128 ms
コンパイル使用メモリ 6,604 KB
実行使用メモリ 34,360 KB
最終ジャッジ日時 2023-08-15 20:40:08
合計ジャッジ時間 3,296 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
5,952 KB
testcase_01 AC 11 ms
5,856 KB
testcase_02 AC 12 ms
5,920 KB
testcase_03 AC 11 ms
5,772 KB
testcase_04 AC 14 ms
5,824 KB
testcase_05 AC 11 ms
5,828 KB
testcase_06 AC 15 ms
5,916 KB
testcase_07 AC 15 ms
6,060 KB
testcase_08 AC 11 ms
5,904 KB
testcase_09 AC 15 ms
6,012 KB
testcase_10 AC 55 ms
8,656 KB
testcase_11 AC 508 ms
34,352 KB
testcase_12 AC 454 ms
34,212 KB
testcase_13 AC 512 ms
34,328 KB
testcase_14 AC 465 ms
34,360 KB
testcase_15 AC 11 ms
5,964 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))
print " ".join(ans)
0