結果

問題 No.1477 Lamps on Graph
ユーザー hir355hir355
提出日時 2021-04-16 20:13:58
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 606 ms / 2,000 ms
コード長 589 bytes
コンパイル時間 310 ms
コンパイル使用メモリ 87,144 KB
実行使用メモリ 119,252 KB
最終ジャッジ日時 2023-09-15 20:33:42
合計ジャッジ時間 15,585 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,288 KB
testcase_01 AC 70 ms
71,016 KB
testcase_02 AC 70 ms
71,172 KB
testcase_03 AC 71 ms
71,060 KB
testcase_04 AC 72 ms
70,968 KB
testcase_05 AC 71 ms
71,236 KB
testcase_06 AC 72 ms
71,228 KB
testcase_07 AC 71 ms
71,116 KB
testcase_08 AC 71 ms
71,308 KB
testcase_09 AC 69 ms
71,220 KB
testcase_10 AC 70 ms
71,088 KB
testcase_11 AC 71 ms
71,084 KB
testcase_12 AC 381 ms
88,556 KB
testcase_13 AC 329 ms
91,488 KB
testcase_14 AC 387 ms
90,248 KB
testcase_15 AC 216 ms
82,648 KB
testcase_16 AC 220 ms
85,448 KB
testcase_17 AC 214 ms
85,176 KB
testcase_18 AC 415 ms
106,388 KB
testcase_19 AC 334 ms
91,356 KB
testcase_20 AC 183 ms
81,152 KB
testcase_21 AC 360 ms
98,100 KB
testcase_22 AC 155 ms
79,020 KB
testcase_23 AC 248 ms
83,092 KB
testcase_24 AC 443 ms
97,580 KB
testcase_25 AC 210 ms
82,176 KB
testcase_26 AC 441 ms
102,032 KB
testcase_27 AC 248 ms
83,812 KB
testcase_28 AC 307 ms
88,008 KB
testcase_29 AC 265 ms
85,296 KB
testcase_30 AC 241 ms
88,964 KB
testcase_31 AC 225 ms
86,132 KB
testcase_32 AC 512 ms
119,252 KB
testcase_33 AC 494 ms
117,624 KB
testcase_34 AC 255 ms
117,088 KB
testcase_35 AC 606 ms
109,992 KB
testcase_36 AC 585 ms
107,756 KB
testcase_37 AC 542 ms
102,972 KB
testcase_38 AC 570 ms
104,060 KB
testcase_39 AC 579 ms
107,552 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m = map(int, input().split())
a = list(map(lambda x:[int(x), 0], input().split()))
g = [[] for _ in range(n)]
for i in range(m):
    u, v = map(int, input().split())
    u -= 1
    v -= 1
    if a[u] > a[v]:
        g[v].append(u)
    elif a[v] > a[u]:
        g[u].append(v)
for i in range(n):
    a[i][1] = i
k = int(input())
b = list(map(int, input().split()))
t = [0] * n
for i in range(k):
    t[b[i] - 1] = 1
a.sort()
res = []
for x, i in a:
    if t[i] == 1:
        res.append(i + 1)
        for node in g[i]:
            t[node] ^= 1
print(len(res))
for x in res:
    print(x)
0