結果

問題 No.1477 Lamps on Graph
ユーザー lie_of_lillielie_of_lillie
提出日時 2021-05-12 20:22:10
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 747 ms / 2,000 ms
コード長 576 bytes
コンパイル時間 319 ms
コンパイル使用メモリ 12,016 KB
実行使用メモリ 43,568 KB
最終ジャッジ日時 2023-10-24 15:08:28
合計ジャッジ時間 15,162 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
10,192 KB
testcase_01 AC 29 ms
10,192 KB
testcase_02 AC 29 ms
10,192 KB
testcase_03 AC 29 ms
10,192 KB
testcase_04 AC 29 ms
10,192 KB
testcase_05 AC 28 ms
10,192 KB
testcase_06 AC 28 ms
10,192 KB
testcase_07 AC 28 ms
10,192 KB
testcase_08 AC 29 ms
10,192 KB
testcase_09 AC 29 ms
10,192 KB
testcase_10 AC 29 ms
10,192 KB
testcase_11 AC 29 ms
10,192 KB
testcase_12 AC 462 ms
26,040 KB
testcase_13 AC 400 ms
26,356 KB
testcase_14 AC 548 ms
28,492 KB
testcase_15 AC 270 ms
16,900 KB
testcase_16 AC 151 ms
19,492 KB
testcase_17 AC 142 ms
18,932 KB
testcase_18 AC 386 ms
37,588 KB
testcase_19 AC 362 ms
27,788 KB
testcase_20 AC 179 ms
15,188 KB
testcase_21 AC 333 ms
33,128 KB
testcase_22 AC 148 ms
12,516 KB
testcase_23 AC 357 ms
18,276 KB
testcase_24 AC 603 ms
33,536 KB
testcase_25 AC 242 ms
16,660 KB
testcase_26 AC 522 ms
35,276 KB
testcase_27 AC 306 ms
19,132 KB
testcase_28 AC 343 ms
24,396 KB
testcase_29 AC 329 ms
21,136 KB
testcase_30 AC 192 ms
24,628 KB
testcase_31 AC 159 ms
20,604 KB
testcase_32 AC 719 ms
43,568 KB
testcase_33 AC 679 ms
43,284 KB
testcase_34 AC 551 ms
40,160 KB
testcase_35 AC 746 ms
43,208 KB
testcase_36 AC 747 ms
42,476 KB
testcase_37 AC 686 ms
40,056 KB
testcase_38 AC 710 ms
40,848 KB
testcase_39 AC 729 ms
42,180 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, M = map(int, input().split())
A = [int(s) for s in input().split()]

X = [[] for _ in range(N)]

for i in range(M):
    U, V = map(int, input().split())
    U -= 1
    V -= 1
    if A[U] < A[V]:
        X[U].append(V)
    if A[V] < A[U]:
        X[V].append(U)

K = int(input())
B = [int(s) for s in input().split()]

L = [False]*N

for i in B:
    L[i - 1] = True

F = sorted([(A[i], i) for i in range(N)])

Y = []

for _, i in F:
    if L[i]:
        Y.append(i+1)
        for j in X[i]:
            L[j] = not L[j]


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