結果

問題 No.1477 Lamps on Graph
ユーザー NatsubiSoganNatsubiSogan
提出日時 2021-04-16 20:31:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 508 ms / 2,000 ms
コード長 558 bytes
コンパイル時間 728 ms
コンパイル使用メモリ 86,944 KB
実行使用メモリ 128,016 KB
最終ジャッジ日時 2023-09-15 21:23:14
合計ジャッジ時間 13,493 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,216 KB
testcase_01 AC 70 ms
71,248 KB
testcase_02 AC 69 ms
71,128 KB
testcase_03 AC 70 ms
70,916 KB
testcase_04 AC 71 ms
71,272 KB
testcase_05 AC 71 ms
71,328 KB
testcase_06 AC 70 ms
71,064 KB
testcase_07 AC 71 ms
71,268 KB
testcase_08 AC 71 ms
71,220 KB
testcase_09 AC 72 ms
71,392 KB
testcase_10 AC 71 ms
71,292 KB
testcase_11 AC 72 ms
71,280 KB
testcase_12 AC 302 ms
89,328 KB
testcase_13 AC 295 ms
93,308 KB
testcase_14 AC 338 ms
93,828 KB
testcase_15 AC 200 ms
81,816 KB
testcase_16 AC 204 ms
81,996 KB
testcase_17 AC 200 ms
82,968 KB
testcase_18 AC 382 ms
104,996 KB
testcase_19 AC 302 ms
93,800 KB
testcase_20 AC 171 ms
80,872 KB
testcase_21 AC 344 ms
108,544 KB
testcase_22 AC 145 ms
79,416 KB
testcase_23 AC 215 ms
83,220 KB
testcase_24 AC 389 ms
104,932 KB
testcase_25 AC 187 ms
82,688 KB
testcase_26 AC 399 ms
103,536 KB
testcase_27 AC 218 ms
83,424 KB
testcase_28 AC 270 ms
86,028 KB
testcase_29 AC 247 ms
85,420 KB
testcase_30 AC 238 ms
94,436 KB
testcase_31 AC 217 ms
86,080 KB
testcase_32 AC 480 ms
127,732 KB
testcase_33 AC 465 ms
124,316 KB
testcase_34 AC 252 ms
128,016 KB
testcase_35 AC 508 ms
115,076 KB
testcase_36 AC 501 ms
111,764 KB
testcase_37 AC 466 ms
97,676 KB
testcase_38 AC 481 ms
101,484 KB
testcase_39 AC 493 ms
111,780 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m = map(int, input().split())
A = list(map(int, input().split()))
A2 = [(A[i], i) for i in range(n)]
A2.sort()
G = [[] for _ in range(n)]
for _ in range(m):
    u, v = map(int, input().split())
    G[u - 1].append(v - 1)
    G[v - 1].append(u - 1)
k = int(input())
B = set(map(int, input().split()))
onoff = [0] * n
for i in B:
    onoff[i - 1] = 1
ans = []
for a, i in A2:
    if onoff[i]:
        ans.append(i + 1)
        onoff[i] ^= 1
        for v in G[i]:
            if a < A[v]: 
                onoff[v] ^= 1
print(len(ans))
print(*ans, sep="\n")
0