結果
| 問題 | No.429 CupShuffle |
| コンテスト | |
| ユーザー |
はむ吉🐹
|
| 提出日時 | 2016-10-02 22:43:17 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 103 ms / 2,000 ms |
| コード長 | 769 bytes |
| 記録 | |
| コンパイル時間 | 227 ms |
| コンパイル使用メモリ | 85,120 KB |
| 実行使用メモリ | 99,072 KB |
| 最終ジャッジ日時 | 2026-05-15 17:09:45 |
| 合計ジャッジ時間 | 1,966 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 16 |
ソースコード
#!/usr/bin/env pypy3
import collections
def main():
n, k, x = map(int, input().split())
cups = list(range(n))
after = collections.deque()
for i in range(k):
if i != x - 1:
a, b = map(lambda c: int(c) - 1, input().split())
if i < x - 1:
cups[a], cups[b] = cups[b], cups[a]
else:
after.append((a, b))
else:
_ = input()
final_cups = list(map(lambda c: int(c) - 1, input().split()))
while after:
a, b = after.pop()
final_cups[a], final_cups[b] = final_cups[b], final_cups[a]
ans = []
for j in range(n):
if cups[j] != final_cups[j]:
ans.append(j + 1)
print(*ans)
if __name__ == '__main__':
main()
はむ吉🐹