結果

問題 No.2509 Beam Shateki
ユーザー ニックネームニックネーム
提出日時 2023-10-20 23:18:43
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,038 bytes
コンパイル時間 230 ms
コンパイル使用メモリ 81,776 KB
実行使用メモリ 70,632 KB
最終ジャッジ日時 2023-10-20 23:19:28
合計ジャッジ時間 6,040 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,516 KB
testcase_01 AC 40 ms
53,516 KB
testcase_02 AC 40 ms
53,516 KB
testcase_03 AC 60 ms
66,696 KB
testcase_04 AC 59 ms
66,696 KB
testcase_05 AC 59 ms
66,696 KB
testcase_06 AC 60 ms
66,696 KB
testcase_07 AC 60 ms
66,696 KB
testcase_08 AC 58 ms
66,696 KB
testcase_09 AC 57 ms
66,696 KB
testcase_10 AC 58 ms
66,696 KB
testcase_11 AC 58 ms
66,696 KB
testcase_12 AC 57 ms
66,696 KB
testcase_13 AC 62 ms
70,552 KB
testcase_14 AC 61 ms
70,552 KB
testcase_15 AC 63 ms
70,552 KB
testcase_16 AC 63 ms
70,552 KB
testcase_17 AC 62 ms
70,552 KB
testcase_18 AC 62 ms
70,552 KB
testcase_19 AC 62 ms
70,552 KB
testcase_20 AC 63 ms
70,552 KB
testcase_21 AC 64 ms
70,552 KB
testcase_22 AC 63 ms
70,552 KB
testcase_23 AC 64 ms
70,552 KB
testcase_24 AC 63 ms
70,552 KB
testcase_25 AC 63 ms
70,552 KB
testcase_26 AC 63 ms
70,552 KB
testcase_27 AC 64 ms
70,552 KB
testcase_28 AC 63 ms
70,552 KB
testcase_29 AC 61 ms
70,552 KB
testcase_30 AC 61 ms
70,552 KB
testcase_31 WA -
testcase_32 AC 62 ms
70,552 KB
testcase_33 AC 50 ms
61,964 KB
testcase_34 AC 54 ms
64,316 KB
testcase_35 AC 59 ms
68,652 KB
testcase_36 AC 52 ms
64,316 KB
testcase_37 AC 51 ms
63,872 KB
testcase_38 AC 53 ms
64,316 KB
testcase_39 AC 53 ms
64,316 KB
testcase_40 AC 56 ms
66,364 KB
testcase_41 AC 40 ms
53,516 KB
testcase_42 AC 54 ms
64,316 KB
testcase_43 AC 60 ms
68,648 KB
testcase_44 AC 61 ms
68,648 KB
testcase_45 AC 52 ms
64,316 KB
testcase_46 AC 55 ms
64,392 KB
testcase_47 AC 62 ms
68,648 KB
testcase_48 AC 54 ms
64,316 KB
testcase_49 AC 60 ms
68,544 KB
testcase_50 AC 57 ms
66,440 KB
testcase_51 AC 46 ms
59,748 KB
testcase_52 AC 56 ms
66,584 KB
testcase_53 AC 40 ms
53,516 KB
testcase_54 AC 40 ms
53,516 KB
testcase_55 AC 40 ms
53,516 KB
testcase_56 AC 40 ms
53,516 KB
testcase_57 AC 40 ms
53,516 KB
testcase_58 WA -
testcase_59 AC 40 ms
53,516 KB
testcase_60 WA -
testcase_61 AC 40 ms
53,516 KB
testcase_62 AC 40 ms
53,516 KB
testcase_63 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

h,w = map(int,input().split())
a = [[0]*(w+3)]+[[0]+list(map(int,input().split()))+[0,0] for _ in range(h)]+[[0]*(w+3),[0]*(w+3)]
s = []; ans = 0
for x in range(h+2):
    for dx in range(-1,2):
        px = x+dx; py = 1; t = set(); u = 0
        while a[px][py]: t.add((px,py)); u += a[px][py]; px += dx; py += 1
        s.append((u,t))
for y in range(w+2):
    for dy in range(-1,2):
        px = 1; py = y+dy; t = set(); u = 0
        while a[px][py]: t.add((px,py)); u += a[px][py]; px += 1; py += dy
        s.append((u,t))
for x in range(h+2):
    dx = 1; px = x+dx; py = w; t = set(); u = 0
    while a[px][py]: t.add((px,py)); u += a[px][py]; px += dx; py += 1
    s.append((u,t))
for y in range(w+2):
    dy = 1; px = h; py = y+dy; t = set(); u = 0
    while a[px][py]: t.add((px,py)); u += a[px][py]; px += 1; py += dy
    s.append((u,t))
s.sort(reverse=True)
for i in range(len(s)-1):
    for j in range(i+1,len(s)):
        if s[i][0]+s[j][0]<ans: break
        ans = max(ans,sum(a[x][y] for x,y in s[i][1]|s[j][1]))
print(ans)
0