結果
問題 | No.429 CupShuffle |
ユーザー | Konton7 |
提出日時 | 2019-05-01 19:35:52 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 832 bytes |
コンパイル時間 | 185 ms |
コンパイル使用メモリ | 10,816 KB |
実行使用メモリ | 40,136 KB |
最終ジャッジ日時 | 2023-08-30 04:27:15 |
合計ジャッジ時間 | 3,831 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | RE | - |
testcase_01 | WA | - |
testcase_02 | RE | - |
testcase_03 | AC | 16 ms
7,768 KB |
testcase_04 | WA | - |
testcase_05 | RE | - |
testcase_06 | RE | - |
testcase_07 | RE | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | RE | - |
testcase_12 | RE | - |
testcase_13 | RE | - |
testcase_14 | AC | 442 ms
40,060 KB |
testcase_15 | AC | 16 ms
7,808 KB |
ソースコード
def swap(inlist,a,b): outlist = inlist outlist[a], outlist[b] = outlist[b], outlist[a] return outlist n, k ,x = [ int(v) for v in input().split(" ") ] up = x - 1 down = k - x uplist, downlist = [], [] for i in range(up): uplist.append([ int(v) for v in input().split(" ") ]) input() for i in range(down): downlist.append([ int(v) for v in input().split(" ") ]) numlistfromup = [i+1 for i in range(n)] numlistfromdown = [ int(v) for v in input().split(" ") ] for i in range(up): numlistfromup = swap(numlistfromup,uplist[i][0]-1,uplist[i][1]-1) for i in range(down): numlistfromdown = swap(numlistfromdown,uplist[down-i-1][0]-1,uplist[down-i-1][1]-1) anslist = [] for i in range(n): if numlistfromup[i] != numlistfromdown[i]: anslist.append(str(i+1)) print(anslist[0] + " " + anslist[1])