結果
問題 | No.2509 Beam Shateki |
ユーザー | mkawa2 |
提出日時 | 2023-10-20 21:47:00 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,915 bytes |
コンパイル時間 | 205 ms |
コンパイル使用メモリ | 82,316 KB |
実行使用メモリ | 83,448 KB |
最終ジャッジ日時 | 2024-09-20 18:09:42 |
合計ジャッジ時間 | 67,570 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 44 ms
61,884 KB |
testcase_01 | AC | 38 ms
60,708 KB |
testcase_02 | AC | 34 ms
53,564 KB |
testcase_03 | AC | 596 ms
82,232 KB |
testcase_04 | AC | 577 ms
81,828 KB |
testcase_05 | AC | 587 ms
82,456 KB |
testcase_06 | AC | 580 ms
81,828 KB |
testcase_07 | AC | 573 ms
81,832 KB |
testcase_08 | AC | 588 ms
81,844 KB |
testcase_09 | AC | 576 ms
81,964 KB |
testcase_10 | AC | 601 ms
82,112 KB |
testcase_11 | AC | 593 ms
81,972 KB |
testcase_12 | AC | 581 ms
82,276 KB |
testcase_13 | TLE | - |
testcase_14 | TLE | - |
testcase_15 | TLE | - |
testcase_16 | TLE | - |
testcase_17 | TLE | - |
testcase_18 | TLE | - |
testcase_19 | TLE | - |
testcase_20 | TLE | - |
testcase_21 | TLE | - |
testcase_22 | TLE | - |
testcase_23 | TLE | - |
testcase_24 | TLE | - |
testcase_25 | TLE | - |
testcase_26 | TLE | - |
testcase_27 | TLE | - |
testcase_28 | TLE | - |
testcase_29 | TLE | - |
testcase_30 | TLE | - |
testcase_31 | TLE | - |
testcase_32 | TLE | - |
testcase_33 | AC | 284 ms
79,472 KB |
testcase_34 | AC | 778 ms
82,484 KB |
testcase_35 | AC | 1,244 ms
82,836 KB |
testcase_36 | AC | 502 ms
81,696 KB |
testcase_37 | AC | 164 ms
77,748 KB |
testcase_38 | AC | 494 ms
81,392 KB |
testcase_39 | AC | 478 ms
80,988 KB |
testcase_40 | AC | 876 ms
82,176 KB |
testcase_41 | AC | 136 ms
77,736 KB |
testcase_42 | AC | 569 ms
81,324 KB |
testcase_43 | AC | 1,486 ms
81,752 KB |
testcase_44 | AC | 1,669 ms
82,116 KB |
testcase_45 | AC | 474 ms
81,448 KB |
testcase_46 | AC | 658 ms
82,336 KB |
testcase_47 | AC | 1,733 ms
82,908 KB |
testcase_48 | AC | 689 ms
82,676 KB |
testcase_49 | AC | 975 ms
81,776 KB |
testcase_50 | AC | 1,172 ms
81,764 KB |
testcase_51 | AC | 299 ms
80,624 KB |
testcase_52 | AC | 849 ms
82,876 KB |
testcase_53 | AC | 45 ms
62,668 KB |
testcase_54 | AC | 44 ms
62,472 KB |
testcase_55 | AC | 53 ms
66,164 KB |
testcase_56 | AC | 51 ms
65,036 KB |
testcase_57 | AC | 52 ms
65,148 KB |
testcase_58 | AC | 52 ms
65,136 KB |
testcase_59 | AC | 52 ms
65,036 KB |
testcase_60 | AC | 53 ms
64,796 KB |
testcase_61 | AC | 53 ms
64,776 KB |
testcase_62 | AC | 52 ms
64,956 KB |
testcase_63 | AC | 54 ms
66,396 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 = {} 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 while 0 <= i < h and 0 <= j < w: res += aa[i][j] i, j = i+di, j+dj memo[si, sj, di, dj] = res return res def cross(i, j, di, dj, p, q, dp, dq): st = set() while 0 <= i < h and 0 <= j < w: st.add((i, j)) i, j = i+di, j+dj i, j = p, q di, dj = dp, dq while 0 <= i < h and 0 <= j < w: if (i, j) in st: return i, j i, j = i+di, j+dj 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)