結果

問題 No.1477 Lamps on Graph
ユーザー Super SolenoidSuper Solenoid
提出日時 2021-05-02 04:28:02
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 620 ms / 2,000 ms
コード長 576 bytes
コンパイル時間 959 ms
コンパイル使用メモリ 10,844 KB
実行使用メモリ 41,432 KB
最終ジャッジ日時 2023-09-27 18:25:30
合計ジャッジ時間 13,066 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,880 KB
testcase_01 AC 15 ms
7,796 KB
testcase_02 AC 14 ms
7,792 KB
testcase_03 AC 13 ms
7,688 KB
testcase_04 AC 13 ms
7,804 KB
testcase_05 AC 14 ms
7,736 KB
testcase_06 AC 13 ms
7,792 KB
testcase_07 AC 14 ms
7,964 KB
testcase_08 AC 14 ms
7,872 KB
testcase_09 AC 15 ms
7,688 KB
testcase_10 AC 15 ms
7,684 KB
testcase_11 AC 16 ms
7,916 KB
testcase_12 AC 389 ms
24,084 KB
testcase_13 AC 321 ms
24,312 KB
testcase_14 AC 445 ms
26,396 KB
testcase_15 AC 226 ms
14,944 KB
testcase_16 AC 121 ms
17,412 KB
testcase_17 AC 111 ms
16,928 KB
testcase_18 AC 336 ms
35,628 KB
testcase_19 AC 286 ms
26,100 KB
testcase_20 AC 140 ms
13,044 KB
testcase_21 AC 269 ms
31,240 KB
testcase_22 AC 123 ms
10,528 KB
testcase_23 AC 300 ms
16,272 KB
testcase_24 AC 486 ms
31,580 KB
testcase_25 AC 189 ms
14,540 KB
testcase_26 AC 418 ms
33,316 KB
testcase_27 AC 247 ms
16,928 KB
testcase_28 AC 269 ms
22,460 KB
testcase_29 AC 251 ms
19,136 KB
testcase_30 AC 140 ms
22,528 KB
testcase_31 AC 120 ms
18,512 KB
testcase_32 AC 617 ms
41,432 KB
testcase_33 AC 613 ms
41,292 KB
testcase_34 AC 473 ms
38,232 KB
testcase_35 AC 610 ms
41,140 KB
testcase_36 AC 620 ms
40,576 KB
testcase_37 AC 550 ms
38,092 KB
testcase_38 AC 584 ms
38,904 KB
testcase_39 AC 610 ms
40,524 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