結果
問題 | No.2095 High Rise |
ユーザー | MasKoaTS |
提出日時 | 2022-10-07 22:07:47 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,401 bytes |
コンパイル時間 | 241 ms |
コンパイル使用メモリ | 82,312 KB |
実行使用メモリ | 247,812 KB |
最終ジャッジ日時 | 2024-06-12 18:41:08 |
合計ジャッジ時間 | 10,270 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 107 ms
92,944 KB |
testcase_01 | AC | 102 ms
86,136 KB |
testcase_02 | AC | 101 ms
86,188 KB |
testcase_03 | AC | 109 ms
86,272 KB |
testcase_04 | AC | 113 ms
86,076 KB |
testcase_05 | AC | 105 ms
86,480 KB |
testcase_06 | AC | 101 ms
86,264 KB |
testcase_07 | AC | 101 ms
86,476 KB |
testcase_08 | AC | 106 ms
86,268 KB |
testcase_09 | AC | 101 ms
86,312 KB |
testcase_10 | AC | 101 ms
86,256 KB |
testcase_11 | AC | 126 ms
86,360 KB |
testcase_12 | AC | 172 ms
90,692 KB |
testcase_13 | AC | 172 ms
90,640 KB |
testcase_14 | AC | 214 ms
91,528 KB |
testcase_15 | AC | 197 ms
90,800 KB |
testcase_16 | AC | 160 ms
90,220 KB |
testcase_17 | AC | 630 ms
107,592 KB |
testcase_18 | AC | 467 ms
100,720 KB |
testcase_19 | AC | 249 ms
92,220 KB |
testcase_20 | AC | 703 ms
112,864 KB |
testcase_21 | AC | 1,279 ms
135,276 KB |
testcase_22 | TLE | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
ソースコード
import itertools as iter import collections as coll import heapq as hq import bisect as bis from decimal import Decimal as dec from functools import cmp_to_key import math import sys #import pypyjit #pypyjit.set_param('max_unroll_recursion=-1') sys.setrecursionlimit(10 ** 6) inp = sys.stdin.readline input = lambda : inp().rstrip() getN = lambda : int(inp()) getNs = lambda : map(int, inp().split()) getList = lambda :list(map(int, inp().split())) getStrs = lambda n : [input() for _ in [0] * n] def yexit(): print("Yes"); exit(0) def nexit(): print("No"); exit(0) pi = 3.141592653589793 mod = 1000000007 MOD = 998244353 INF = 4611686018427387903 dx = [1, 0, -1, 0]; dy = [0, 1, 0, -1] #di = coll.defaultdict(int) """ Main Code """ n, m = getNs() a = [getList() for _ in [0]*n] dp = [[[INF]*2 for _ in [0]*m] for _ in [0]*n] dp[0][0][0] = 0 que = [(0,0,0,0)] while(que): #print(que) c,p,q,r = hq.heappop(que) if(c > dp[p][q][r]): continue if(p == n - 1): print(c) break if(q > 0 and c < dp[p][q-1][0]): dp[p][q-1][0] = c hq.heappush(que, (c,p,q-1,0)) if(q < m - 1 and c < dp[p][q+1][0]): dp[p][q+1][0] = c hq.heappush(que, (c,p,q+1,0)) if(r == 0): nc = c + a[p][q] if(nc >= dp[p][q][1]): continue dp[p][q][1] = nc hq.heappush(que, (nc,p,q,1)) else: nc = c + a[p+1][q] if(nc >= dp[p+1][q][1]): continue dp[p+1][q][1] = nc hq.heappush(que, (nc,p+1,q,1))