結果
| 問題 | No.429 CupShuffle | 
| コンテスト | |
| ユーザー |  はむ吉🐹 | 
| 提出日時 | 2016-10-02 22:43:17 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 150 ms / 2,000 ms | 
| コード長 | 769 bytes | 
| コンパイル時間 | 147 ms | 
| コンパイル使用メモリ | 82,396 KB | 
| 実行使用メモリ | 93,932 KB | 
| 最終ジャッジ日時 | 2024-11-21 13:21:00 | 
| 合計ジャッジ時間 | 2,083 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| 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()
            
            
            
        