結果

問題 No.1477 Lamps on Graph
ユーザー 👑 H20H20
提出日時 2021-04-21 13:09:09
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 593 bytes
コンパイル時間 253 ms
コンパイル使用メモリ 87,000 KB
実行使用メモリ 122,056 KB
最終ジャッジ日時 2023-09-17 09:28:33
合計ジャッジ時間 12,833 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,280 KB
testcase_01 AC 71 ms
71,056 KB
testcase_02 AC 69 ms
71,400 KB
testcase_03 AC 70 ms
71,328 KB
testcase_04 AC 75 ms
71,348 KB
testcase_05 WA -
testcase_06 AC 71 ms
71,300 KB
testcase_07 AC 71 ms
71,112 KB
testcase_08 AC 69 ms
71,388 KB
testcase_09 AC 73 ms
71,016 KB
testcase_10 WA -
testcase_11 AC 71 ms
71,328 KB
testcase_12 AC 284 ms
89,988 KB
testcase_13 AC 270 ms
94,456 KB
testcase_14 AC 303 ms
96,600 KB
testcase_15 AC 189 ms
83,444 KB
testcase_16 AC 182 ms
87,480 KB
testcase_17 AC 180 ms
86,620 KB
testcase_18 AC 315 ms
104,400 KB
testcase_19 AC 273 ms
96,580 KB
testcase_20 AC 166 ms
81,312 KB
testcase_21 AC 269 ms
103,644 KB
testcase_22 AC 151 ms
79,128 KB
testcase_23 AC 212 ms
85,032 KB
testcase_24 AC 366 ms
102,928 KB
testcase_25 AC 185 ms
82,288 KB
testcase_26 AC 346 ms
101,012 KB
testcase_27 AC 209 ms
85,008 KB
testcase_28 AC 244 ms
88,564 KB
testcase_29 AC 220 ms
86,164 KB
testcase_30 AC 192 ms
94,524 KB
testcase_31 AC 188 ms
88,456 KB
testcase_32 AC 374 ms
122,056 KB
testcase_33 AC 360 ms
119,552 KB
testcase_34 WA -
testcase_35 AC 432 ms
112,660 KB
testcase_36 AC 422 ms
110,740 KB
testcase_37 AC 385 ms
101,192 KB
testcase_38 AC 402 ms
104,488 KB
testcase_39 AC 430 ms
110,012 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M=map(int,input().split())
A=[-1]+list(map(int,input().split()))
AS= [[0] * 2 for i in range(N+1)]
for i,a in enumerate(A):
    AS[i][0]=i
    AS[i][1]=a

AS = sorted(AS, key=lambda x: x[1])

L = []
for i in range(N+1):
    L.append([])
for i in range(M):
    v,u = map(int,input().split())
    L[v].append(u)
    L[u].append(v)
K = int(input())
B=list(map(int,input().split()))
LAMP=[False]*(N+1)
for b in B:
    LAMP[b]=True
ANS = []
for i,a in AS:
    if LAMP[i]:
        ANS.append(i)
        for l in L[i]:
            LAMP[l]=not LAMP[l]
print(len(ANS))
for ans in ANS:
    print(ans)
0