結果
問題 | No.2509 Beam Shateki |
ユーザー | mkawa2 |
提出日時 | 2023-10-20 22:00:43 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 1,389 ms / 2,000 ms |
コード長 | 1,877 bytes |
コンパイル時間 | 933 ms |
コンパイル使用メモリ | 82,452 KB |
実行使用メモリ | 87,980 KB |
最終ジャッジ日時 | 2024-09-20 18:58:14 |
合計ジャッジ時間 | 47,025 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 39 ms
59,840 KB |
testcase_01 | AC | 41 ms
58,644 KB |
testcase_02 | AC | 36 ms
53,888 KB |
testcase_03 | AC | 504 ms
83,716 KB |
testcase_04 | AC | 493 ms
84,172 KB |
testcase_05 | AC | 501 ms
83,988 KB |
testcase_06 | AC | 506 ms
84,000 KB |
testcase_07 | AC | 506 ms
84,388 KB |
testcase_08 | AC | 493 ms
83,716 KB |
testcase_09 | AC | 515 ms
83,968 KB |
testcase_10 | AC | 497 ms
84,228 KB |
testcase_11 | AC | 524 ms
84,116 KB |
testcase_12 | AC | 500 ms
83,980 KB |
testcase_13 | AC | 1,360 ms
86,196 KB |
testcase_14 | AC | 1,366 ms
86,200 KB |
testcase_15 | AC | 1,354 ms
86,320 KB |
testcase_16 | AC | 1,358 ms
86,580 KB |
testcase_17 | AC | 1,353 ms
86,316 KB |
testcase_18 | AC | 1,349 ms
86,708 KB |
testcase_19 | AC | 1,350 ms
86,580 KB |
testcase_20 | AC | 1,338 ms
86,444 KB |
testcase_21 | AC | 1,342 ms
86,316 KB |
testcase_22 | AC | 1,357 ms
86,192 KB |
testcase_23 | AC | 1,342 ms
86,448 KB |
testcase_24 | AC | 1,327 ms
86,580 KB |
testcase_25 | AC | 1,328 ms
86,452 KB |
testcase_26 | AC | 1,342 ms
86,576 KB |
testcase_27 | AC | 1,340 ms
86,448 KB |
testcase_28 | AC | 1,330 ms
86,800 KB |
testcase_29 | AC | 1,335 ms
86,320 KB |
testcase_30 | AC | 1,389 ms
86,448 KB |
testcase_31 | AC | 1,340 ms
86,448 KB |
testcase_32 | AC | 1,350 ms
86,324 KB |
testcase_33 | AC | 285 ms
79,964 KB |
testcase_34 | AC | 647 ms
84,512 KB |
testcase_35 | AC | 908 ms
87,660 KB |
testcase_36 | AC | 463 ms
83,044 KB |
testcase_37 | AC | 158 ms
77,756 KB |
testcase_38 | AC | 453 ms
84,160 KB |
testcase_39 | AC | 467 ms
82,792 KB |
testcase_40 | AC | 672 ms
86,332 KB |
testcase_41 | AC | 125 ms
77,980 KB |
testcase_42 | AC | 523 ms
84,328 KB |
testcase_43 | AC | 983 ms
86,624 KB |
testcase_44 | AC | 1,100 ms
86,932 KB |
testcase_45 | AC | 447 ms
83,804 KB |
testcase_46 | AC | 591 ms
84,088 KB |
testcase_47 | AC | 1,132 ms
87,980 KB |
testcase_48 | AC | 561 ms
83,584 KB |
testcase_49 | AC | 735 ms
85,480 KB |
testcase_50 | AC | 796 ms
85,388 KB |
testcase_51 | AC | 289 ms
81,868 KB |
testcase_52 | AC | 673 ms
85,948 KB |
testcase_53 | AC | 42 ms
62,436 KB |
testcase_54 | AC | 41 ms
62,916 KB |
testcase_55 | AC | 44 ms
64,568 KB |
testcase_56 | AC | 43 ms
63,612 KB |
testcase_57 | AC | 46 ms
65,284 KB |
testcase_58 | AC | 44 ms
64,668 KB |
testcase_59 | AC | 46 ms
64,876 KB |
testcase_60 | AC | 50 ms
64,476 KB |
testcase_61 | AC | 45 ms
64,316 KB |
testcase_62 | AC | 48 ms
64,500 KB |
testcase_63 | AC | 44 ms
64,048 KB |
ソースコード
import sys # sys.setrecursionlimit(200005) # sys.set_int_max_str_digits(200005) int1 = lambda x: int(x)-1 pDB = lambda *x: print(*x, end="\n", file=sys.stderr) p2D = lambda x: print(*x, sep="\n", end="\n\n", file=sys.stderr) def II(): return int(sys.stdin.readline()) def LI(): return list(map(int, sys.stdin.readline().split())) def LLI(rows_number): return [LI() for _ in range(rows_number)] def LI1(): return list(map(int1, sys.stdin.readline().split())) def LLI1(rows_number): return [LI1() for _ in range(rows_number)] def SI(): return sys.stdin.readline().rstrip() dij = [(0, 1), (-1, 0), (0, -1), (1, 0)] # dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)] inf = -1-(-1 << 31) # inf = -1-(-1 << 63) # md = 10**9+7 md = 998244353 memo = {} ijs = {} def line(si, sj, di, dj): if (si, sj, di, dj) in memo: return memo[si, sj, di, dj] res = 0 i, j = si, sj st = set() while 0 <= i < h and 0 <= j < w: st.add((i, j)) res += aa[i][j] i, j = i+di, j+dj memo[si, sj, di, dj] = res ijs[si, sj, di, dj] = st return res def cross(i, j, di, dj, p, q, dp, dq): s=ijs[i, j, di, dj] t=ijs[p, q, dp, dq] if len(s)>len(t):s,t=t,s for a in s: if a in t:return a return -1,-1 def start(): for i in range(h): yield i, 0, 0, 1 yield i, 0, -1, 1 yield i, 0, 1, 1 for j in range(w): yield 0, j, 1, 0 yield 0, j, 1, 1 yield h-1, j, -1, 1 h, w = LI() aa = LLI(h) ans = 0 for i, j, di, dj in start(): for p, q, dp, dq in start(): if (i, j, di, dj) == (p, q, dp, dq): continue cur = line(i, j, di, dj)+line(p, q, dp, dq) ci, cj = cross(i, j, di, dj, p, q, dp, dq) if ci != -1: cur -= aa[ci][cj] if cur > ans: ans = cur # print(ans, i, j, di, dj, p, q, dp, dq) print(ans)