結果
問題 |
No.20 砂漠のオアシス
|
ユーザー |
![]() |
提出日時 | 2015-08-01 10:27:12 |
言語 | PyPy2 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 588 bytes |
コンパイル時間 | 1,651 ms |
コンパイル使用メモリ | 76,444 KB |
実行使用メモリ | 86,988 KB |
最終ジャッジ日時 | 2024-10-13 05:21:13 |
合計ジャッジ時間 | 8,774 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 4 WA * 1 TLE * 1 -- * 15 |
ソースコード
N,V,ox,oy=map(int,raw_input().split()) ox-=1;oy-=1 L=[] for _ in xrange(N): L.append(map(int,raw_input().split())) dxdy=zip([-1,0,1,0],[0,-1,0,1]) que=[[0,0,V]] visited=[] while que: cx,cy,v=que.pop(0) for dx,dy in dxdy: nx,ny=cx+dx,cy+dy if nx==N-1 and ny==N-1: print 'YES' exit() if not(0<=nx<N and 0<=ny<N):continue nv=v-L[cy][cx] if cx==ox and cy==oy: nv=nv*2 if nv>0 and [nx,ny] not in visited: que.append([nx,ny,nv]) visited.append([nx,ny]) else: print 'NO'