結果

問題 No.1477 Lamps on Graph
ユーザー taiga000629taiga000629
提出日時 2021-04-16 22:23:58
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 732 bytes
コンパイル時間 400 ms
コンパイル使用メモリ 87,140 KB
実行使用メモリ 99,584 KB
最終ジャッジ日時 2023-09-16 01:15:03
合計ジャッジ時間 9,983 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
75,832 KB
testcase_01 AC 68 ms
71,240 KB
testcase_02 AC 67 ms
71,420 KB
testcase_03 AC 67 ms
71,360 KB
testcase_04 AC 67 ms
71,104 KB
testcase_05 AC 66 ms
71,140 KB
testcase_06 AC 67 ms
71,292 KB
testcase_07 AC 68 ms
71,420 KB
testcase_08 AC 67 ms
71,292 KB
testcase_09 AC 69 ms
71,284 KB
testcase_10 AC 67 ms
71,148 KB
testcase_11 AC 69 ms
71,228 KB
testcase_12 AC 488 ms
94,396 KB
testcase_13 AC 406 ms
92,988 KB
testcase_14 AC 590 ms
97,512 KB
testcase_15 AC 598 ms
87,080 KB
testcase_16 AC 233 ms
86,360 KB
testcase_17 AC 231 ms
85,856 KB
testcase_18 AC 253 ms
99,584 KB
testcase_19 AC 357 ms
93,848 KB
testcase_20 AC 352 ms
84,692 KB
testcase_21 AC 245 ms
98,192 KB
testcase_22 TLE -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m=map(int,input().split())
a=[-1]+list(map(int,input().split()))
root=[[] for i in range(n+1)]
rootr=[[] for i in range(n+1)]
import sys
sys.setrecursionlimit(10**9)
for i in range(m):
    v,u=map(int,input().split())
    if a[v]>a[u]:
        root[u].append(v)
        rootr[v].append(u)
    elif a[u]>a[v]:
        root[v].append(u)
        rootr[u].append(v)
memo=[-1]*(n+1)
light=[0]*(n+1)
ans=[]
k=int(input())
b=list(map(int,input().split()))
for x in b:light[x]=1
def ch(x):
    light[x]^=1
    ans.append(x)
    for nod in root[x]:
        light[nod]^=1
def f(x):
    if memo[x]==1:pass
    for nod in rootr[x]:f(nod)
    if light[x]==1:ch(x)
    memo[x]=1
for i in range(1,n+1):f(i)
print(len(ans))
for x in ans:print(x)
0