結果

問題 No.1477 Lamps on Graph
ユーザー roarisroaris
提出日時 2021-04-16 21:29:34
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 484 ms / 2,000 ms
コード長 611 bytes
コンパイル時間 275 ms
コンパイル使用メモリ 86,856 KB
実行使用メモリ 108,696 KB
最終ジャッジ日時 2023-09-15 23:36:26
合計ジャッジ時間 12,430 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,176 KB
testcase_01 AC 71 ms
71,212 KB
testcase_02 AC 71 ms
71,360 KB
testcase_03 AC 71 ms
71,280 KB
testcase_04 AC 71 ms
71,404 KB
testcase_05 AC 72 ms
71,560 KB
testcase_06 AC 70 ms
71,488 KB
testcase_07 AC 70 ms
71,212 KB
testcase_08 AC 70 ms
71,284 KB
testcase_09 AC 70 ms
71,208 KB
testcase_10 AC 69 ms
71,116 KB
testcase_11 AC 70 ms
71,456 KB
testcase_12 AC 273 ms
87,144 KB
testcase_13 AC 264 ms
89,588 KB
testcase_14 AC 298 ms
90,004 KB
testcase_15 AC 171 ms
81,528 KB
testcase_16 AC 192 ms
83,132 KB
testcase_17 AC 191 ms
83,072 KB
testcase_18 AC 373 ms
97,724 KB
testcase_19 AC 284 ms
89,720 KB
testcase_20 AC 149 ms
80,452 KB
testcase_21 AC 319 ms
94,296 KB
testcase_22 AC 121 ms
78,352 KB
testcase_23 AC 194 ms
83,036 KB
testcase_24 AC 354 ms
97,532 KB
testcase_25 AC 170 ms
81,412 KB
testcase_26 AC 374 ms
95,512 KB
testcase_27 AC 194 ms
82,580 KB
testcase_28 AC 248 ms
85,720 KB
testcase_29 AC 218 ms
84,032 KB
testcase_30 AC 220 ms
87,716 KB
testcase_31 AC 203 ms
83,788 KB
testcase_32 AC 441 ms
108,488 KB
testcase_33 AC 432 ms
108,200 KB
testcase_34 AC 206 ms
108,696 KB
testcase_35 AC 470 ms
102,916 KB
testcase_36 AC 484 ms
100,924 KB
testcase_37 AC 445 ms
96,216 KB
testcase_38 AC 460 ms
97,172 KB
testcase_39 AC 467 ms
100,552 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N, M = map(int, input().split())
A = list(map(int, input().split()))
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 = list(map(int, input().split()))
flag = [False]*N

for Bi in B:
    flag[Bi-1] = True

Ai = [(A[i], i) for i in range(N)]
Ai.sort()
ans = []

for _, v in Ai:
    if flag[v]:
        ans.append(v+1)
        
        for nv in G[v]:
            if A[v]<A[nv]:
                flag[nv] ^= True

print(len(ans))

for i in range(len(ans)):
    print(ans[i])
0