結果
問題 |
No.1465 Archaea
|
ユーザー |
|
提出日時 | 2025-04-16 21:31:58 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 693 bytes |
コンパイル時間 | 682 ms |
コンパイル使用メモリ | 81,356 KB |
実行使用メモリ | 109,760 KB |
最終ジャッジ日時 | 2025-04-16 21:32:03 |
合計ジャッジ時間 | 4,669 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 4 |
other | WA * 20 |
ソースコード
import heapq from collections import deque N,K = map(int,input().split()) Visited = [0]*(N+1) Visited[1] = 0 que = [1] G = {1:[]} while que: x = heapq.heappop(que) if Visited[x]==1:continue Visited[x] = 1 y = 2*x if y<=N and Visited[y]==0: heapq.heappush(que,y) G[y] = [] G[x].append(y) y = x+3 if y<=N and Visited[y]==0: heapq.heappush(que,y) G[y] = [] G[x].append(y) dist = [-1]*(N+1) dist[1] = 0 que = deque([1]) while que: x = que.popleft() for y in G[x]: if dist[y]==-1: dist[y] = dist[x]+1 que.append(y) if dist[N]==-1 or dist[N]>K: print("No") else: print("Yes")