結果

問題 No.1477 Lamps on Graph
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2021-04-16 20:28:43
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 558 ms / 2,000 ms
コード長 594 bytes
コンパイル時間 261 ms
コンパイル使用メモリ 87,224 KB
実行使用メモリ 114,700 KB
最終ジャッジ日時 2023-09-15 21:18:04
合計ジャッジ時間 14,151 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,464 KB
testcase_01 AC 71 ms
71,584 KB
testcase_02 AC 71 ms
71,588 KB
testcase_03 AC 71 ms
71,136 KB
testcase_04 AC 76 ms
71,292 KB
testcase_05 AC 72 ms
71,468 KB
testcase_06 AC 73 ms
71,540 KB
testcase_07 AC 71 ms
71,136 KB
testcase_08 AC 70 ms
71,288 KB
testcase_09 AC 71 ms
71,368 KB
testcase_10 AC 71 ms
71,316 KB
testcase_11 AC 70 ms
71,348 KB
testcase_12 AC 310 ms
90,492 KB
testcase_13 AC 302 ms
93,644 KB
testcase_14 AC 345 ms
93,292 KB
testcase_15 AC 202 ms
83,172 KB
testcase_16 AC 216 ms
85,400 KB
testcase_17 AC 212 ms
84,756 KB
testcase_18 AC 418 ms
102,832 KB
testcase_19 AC 330 ms
92,756 KB
testcase_20 AC 173 ms
79,848 KB
testcase_21 AC 353 ms
95,004 KB
testcase_22 AC 152 ms
79,196 KB
testcase_23 AC 229 ms
84,616 KB
testcase_24 AC 409 ms
100,608 KB
testcase_25 AC 193 ms
82,268 KB
testcase_26 AC 420 ms
100,408 KB
testcase_27 AC 228 ms
85,780 KB
testcase_28 AC 284 ms
89,060 KB
testcase_29 AC 247 ms
87,160 KB
testcase_30 AC 239 ms
90,668 KB
testcase_31 AC 226 ms
86,484 KB
testcase_32 AC 506 ms
114,528 KB
testcase_33 AC 488 ms
114,220 KB
testcase_34 AC 250 ms
114,700 KB
testcase_35 AC 547 ms
105,400 KB
testcase_36 AC 558 ms
104,332 KB
testcase_37 AC 515 ms
101,388 KB
testcase_38 AC 538 ms
102,292 KB
testcase_39 AC 537 ms
104,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m = map(int,input().split())
e = [[] for i in range(n)]
A = list(map(int,input().split()))
for i in range(m):
    u,v = map(int,input().split())
    u -= 1
    v -= 1
    e[u].append(v)
    e[v].append(u)

k = int(input())
B = list(map(int,input().split()))

ans = []
switch = [0]*n
for b in B:
    switch[b-1] = 1
sA = [[A[i],i] for i in range(n)]
sA.sort()
for a,ind in sA:
    if switch[ind] == 0:
        continue
    switch[ind] = 0
    ans.append(ind+1)
    for nex in e[ind]:
        if A[nex] > a:
            switch[nex] = (switch[nex]+1)%2
print(len(ans))
for i in ans:
    print(i)
0