結果

問題 No.429 CupShuffle
ユーザー 👑 yumechiyumechi
提出日時 2016-10-02 23:31:02
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 181 ms / 2,000 ms
コード長 778 bytes
コンパイル時間 1,448 ms
コンパイル使用メモリ 86,592 KB
実行使用メモリ 97,024 KB
最終ジャッジ日時 2023-08-13 18:08:16
合計ジャッジ時間 3,155 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 85 ms
75,744 KB
testcase_01 AC 69 ms
71,216 KB
testcase_02 AC 71 ms
71,328 KB
testcase_03 AC 70 ms
71,220 KB
testcase_04 AC 80 ms
71,064 KB
testcase_05 AC 69 ms
71,364 KB
testcase_06 AC 85 ms
75,580 KB
testcase_07 AC 86 ms
75,780 KB
testcase_08 AC 71 ms
71,200 KB
testcase_09 AC 86 ms
75,728 KB
testcase_10 AC 111 ms
77,968 KB
testcase_11 AC 181 ms
96,520 KB
testcase_12 AC 180 ms
97,024 KB
testcase_13 AC 181 ms
96,856 KB
testcase_14 AC 181 ms
96,280 KB
testcase_15 AC 70 ms
71,140 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve():
    n, k, x = map(int, input().split())
    start = [i for i in range(n)]
    executelist = []
    for i in range(k):
        li = input().split()
        a, b = 0, 0
        if(i != x-1):
            a, b = map(lambda inp: int(inp)-1, li)
        else:
            a, b = "?", "?"
        executelist.append([a, b])
    end = [int(i) - 1 for i in input().split()]

    for i in range(x-1):
        f, s = executelist[i][0], executelist[i][1]
        start[f], start[s] = start[s], start[f]
    for i in range(k-1, x-1, -1):
        f, s = executelist[i][0], executelist[i][1]
        end[f], end[s] = end[s], end[f]
    ans = []
    for i in range(n):
        if start[i] != end[i]:
            ans.append(i+1)
    print(*ans)

if __name__=="__main__":
    solve()
0