結果
| 問題 |
No.3093 Safe Infection
|
| コンテスト | |
| ユーザー |
timi
|
| 提出日時 | 2025-04-07 23:44:57 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 365 ms / 2,000 ms |
| コード長 | 510 bytes |
| コンパイル時間 | 272 ms |
| コンパイル使用メモリ | 82,512 KB |
| 実行使用メモリ | 98,448 KB |
| 最終ジャッジ日時 | 2025-04-07 23:45:16 |
| 合計ジャッジ時間 | 17,753 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 70 |
ソースコード
N,M,K=map(int, input().split())
A=list(map(int, input().split()))
import heapq
V=[-1]*N
a=min(A)
D=[[] for i in range(N)]
for _ in range(M):
x,y=map(int, input().split())
x-=1;y-=1
D[x].append(y);D[y].append(x)
E=[]
for i in range(N):
if A[i]==a:
V[i]=1
heapq.heappush(E,(A[i],i))
B=[a]
while E:
s,idx=heapq.heappop(E)
B.append(s)
for nex in D[idx]:
if V[nex]==-1:
V[nex]=1;heapq.heappush(E,(A[nex],nex))
if B[-1]-B[-2]>K:
print('No')
exit()
print('Yes')
timi