結果
問題 | No.2366 登校 |
ユーザー | titia |
提出日時 | 2023-07-01 02:20:34 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 963 bytes |
コンパイル時間 | 302 ms |
コンパイル使用メモリ | 86,840 KB |
実行使用メモリ | 176,580 KB |
最終ジャッジ日時 | 2023-09-22 05:25:19 |
合計ジャッジ時間 | 38,284 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 154 ms
78,576 KB |
testcase_01 | AC | 77 ms
71,356 KB |
testcase_02 | AC | 97 ms
76,356 KB |
testcase_03 | AC | 138 ms
78,476 KB |
testcase_04 | AC | 77 ms
71,012 KB |
testcase_05 | AC | 115 ms
77,580 KB |
testcase_06 | AC | 133 ms
77,856 KB |
testcase_07 | AC | 164 ms
79,120 KB |
testcase_08 | AC | 217 ms
80,544 KB |
testcase_09 | AC | 206 ms
79,908 KB |
testcase_10 | AC | 99 ms
76,552 KB |
testcase_11 | AC | 100 ms
76,424 KB |
testcase_12 | AC | 2,720 ms
119,072 KB |
testcase_13 | AC | 2,458 ms
116,560 KB |
testcase_14 | AC | 2,577 ms
119,128 KB |
testcase_15 | AC | 2,615 ms
121,536 KB |
testcase_16 | AC | 2,586 ms
115,860 KB |
testcase_17 | AC | 2,640 ms
118,692 KB |
testcase_18 | AC | 2,577 ms
121,404 KB |
testcase_19 | AC | 2,589 ms
118,268 KB |
testcase_20 | AC | 2,674 ms
120,260 KB |
testcase_21 | AC | 2,538 ms
117,932 KB |
testcase_22 | AC | 2,112 ms
117,452 KB |
testcase_23 | AC | 1,049 ms
115,360 KB |
testcase_24 | WA | - |
testcase_25 | TLE | - |
testcase_26 | -- | - |
ソースコード
import sys input = sys.stdin.readline from heapq import heappop,heappush N,M,K,T=map(int,input().split()) X=[[(-1,-1)]*M for i in range(N)] for i in range(K): a,b,c,d=map(int,input().split()) a-=1 b-=1 X[a][b]=[c,d] DP=[[[1<<63]*M for i in range(N)] for j in range(400)] Q=[(0,0,0,0)] DP[200][0][0]=0 while Q: #print(Q) now,x,y,time=heappop(Q) if DP[time+200][x][y]!=now: continue for z,w in [(x,y+1),(x,y-1),(x+1,y),(x-1,y)]: if 0<=z<N and 0<=w<M and 0<=time+1+200<400 and DP[time+1+200][z][w]>now: DP[time+1+200][z][w]=now heappush(Q,(DP[time+1+200][z][w],z,w,time+1)) if X[x][y]!=(-1,-1): c,d=X[x][y] if 0<=time-c+1+200<400 and DP[time-c+1+200][x][y]>now+d: DP[time-c+1+200][x][y]=now+d heappush(Q,(DP[time-c+1+200][x][y],x,y,time-c+1)) ANS=1<<63 for i in range(400): if i-200<=T: ANS=min(ANS,DP[i][N-1][M-1]) print(ANS)