結果
問題 | No.1477 Lamps on Graph |
ユーザー |
|
提出日時 | 2021-04-16 20:28:43 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 562 ms / 2,000 ms |
コード長 | 594 bytes |
コンパイル時間 | 257 ms |
コンパイル使用メモリ | 82,340 KB |
実行使用メモリ | 114,560 KB |
最終ジャッジ日時 | 2024-07-02 22:47:26 |
合計ジャッジ時間 | 12,581 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 38 |
ソースコード
n,m = map(int,input().split())e = [[] for i in range(n)]A = list(map(int,input().split()))for i in range(m):u,v = map(int,input().split())u -= 1v -= 1e[u].append(v)e[v].append(u)k = int(input())B = list(map(int,input().split()))ans = []switch = [0]*nfor b in B:switch[b-1] = 1sA = [[A[i],i] for i in range(n)]sA.sort()for a,ind in sA:if switch[ind] == 0:continueswitch[ind] = 0ans.append(ind+1)for nex in e[ind]:if A[nex] > a:switch[nex] = (switch[nex]+1)%2print(len(ans))for i in ans:print(i)