結果

問題 No.1477 Lamps on Graph
ユーザー shigeokushigeoku
提出日時 2021-04-16 21:45:29
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 553 ms / 2,000 ms
コード長 669 bytes
コンパイル時間 270 ms
コンパイル使用メモリ 86,984 KB
実行使用メモリ 117,696 KB
最終ジャッジ日時 2023-09-16 00:05:26
合計ジャッジ時間 13,848 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,300 KB
testcase_01 AC 75 ms
70,976 KB
testcase_02 AC 73 ms
71,064 KB
testcase_03 AC 75 ms
71,116 KB
testcase_04 AC 74 ms
71,252 KB
testcase_05 AC 73 ms
71,300 KB
testcase_06 AC 72 ms
71,144 KB
testcase_07 AC 74 ms
70,948 KB
testcase_08 AC 72 ms
71,268 KB
testcase_09 AC 73 ms
70,948 KB
testcase_10 AC 75 ms
71,152 KB
testcase_11 AC 75 ms
71,192 KB
testcase_12 AC 331 ms
96,228 KB
testcase_13 AC 314 ms
95,532 KB
testcase_14 AC 361 ms
99,244 KB
testcase_15 AC 216 ms
87,308 KB
testcase_16 AC 218 ms
85,200 KB
testcase_17 AC 216 ms
84,932 KB
testcase_18 AC 399 ms
99,180 KB
testcase_19 AC 322 ms
94,532 KB
testcase_20 AC 181 ms
83,852 KB
testcase_21 AC 351 ms
97,660 KB
testcase_22 AC 173 ms
81,872 KB
testcase_23 AC 252 ms
90,348 KB
testcase_24 AC 422 ms
105,152 KB
testcase_25 AC 206 ms
84,528 KB
testcase_26 AC 430 ms
100,168 KB
testcase_27 AC 244 ms
89,216 KB
testcase_28 AC 288 ms
89,704 KB
testcase_29 AC 265 ms
90,204 KB
testcase_30 AC 245 ms
87,768 KB
testcase_31 AC 228 ms
85,584 KB
testcase_32 AC 511 ms
117,696 KB
testcase_33 AC 497 ms
116,008 KB
testcase_34 AC 280 ms
116,116 KB
testcase_35 AC 537 ms
110,148 KB
testcase_36 AC 553 ms
109,872 KB
testcase_37 AC 503 ms
106,528 KB
testcase_38 AC 509 ms
107,940 KB
testcase_39 AC 531 ms
109,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, M = map(int, input().split())
An = list(map(int, input().split()))
UV = [list(map(int, input().split())) for _ in range(M)]
K = int(input())
Bn = list(map(int, input().split()))

An_s = []
for i, A in enumerate(An, 1):
    An_s.append((A, i))
An_s.sort()
graph = [[] for _ in range(N+1)]
for U, V in UV:
    graph[U].append(V)
    graph[V].append(U)

light = [False] * (N+1)
for B in Bn:
    light[B] = True
ans = []
for v, i in An_s:
    if not light[i]:
        continue
    ans.append(i)
    light[i] = not light[i]
    for g in graph[i]:
        if An[g-1] <= v:
            continue
        light[g] = not light[g]

print(len(ans))
print(*ans, sep='\n')        
0