結果
| 問題 |
No.429 CupShuffle
|
| ユーザー |
maesora
|
| 提出日時 | 2016-10-31 15:37:59 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 487 ms / 2,000 ms |
| コード長 | 758 bytes |
| コンパイル時間 | 413 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 44,284 KB |
| 最終ジャッジ日時 | 2024-11-25 00:06:10 |
| 合計ジャッジ時間 | 3,500 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 16 |
ソースコード
# coding: utf-8
def swap(l, x, y):
x -= 1
y -= 1
buf = l[x]
l[x] = l[y]
l[y] = buf
N, K, X = map(int, input().split(" "))
cup_list = list(range(N))
swap_list_a = []
swap_list_b = []
for i in range(1, K + 1):
if i == X:
input()
continue
elif i < X:
swap_list_a.append(list(map(int, input().split(" "))))
else:
swap_list_b.append(list(map(int, input().split(" "))))
swap_list_b.reverse()
final_cup_list = list(map(lambda s:int(s)-1, input().split(" ")))
for s in swap_list_a:
swap(cup_list, s[0], s[1])
for s in swap_list_b:
swap(final_cup_list, s[0], s[1])
s = []
for i in range(N):
if cup_list[i] != final_cup_list[i]:
s.append(i + 1)
print("{} {}".format(s[0], s[1]))
maesora