結果

問題 No.2509 Beam Shateki
ユーザー ニックネームニックネーム
提出日時 2023-10-20 23:14:33
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 718 bytes
コンパイル時間 762 ms
コンパイル使用メモリ 11,776 KB
実行使用メモリ 16,136 KB
最終ジャッジ日時 2023-10-20 23:14:39
合計ジャッジ時間 5,400 ms
ジャッジサーバーID
(参考情報)
judge11 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,176 KB
testcase_01 AC 29 ms
10,176 KB
testcase_02 AC 30 ms
10,172 KB
testcase_03 AC 40 ms
11,232 KB
testcase_04 AC 40 ms
11,232 KB
testcase_05 AC 40 ms
11,232 KB
testcase_06 AC 40 ms
11,232 KB
testcase_07 AC 40 ms
11,232 KB
testcase_08 AC 41 ms
11,232 KB
testcase_09 AC 40 ms
11,232 KB
testcase_10 AC 40 ms
11,232 KB
testcase_11 AC 39 ms
11,232 KB
testcase_12 AC 39 ms
11,232 KB
testcase_13 AC 69 ms
16,136 KB
testcase_14 AC 70 ms
16,132 KB
testcase_15 AC 70 ms
16,136 KB
testcase_16 AC 68 ms
16,136 KB
testcase_17 AC 70 ms
16,132 KB
testcase_18 AC 70 ms
16,136 KB
testcase_19 AC 71 ms
16,136 KB
testcase_20 AC 69 ms
16,136 KB
testcase_21 AC 69 ms
16,136 KB
testcase_22 AC 71 ms
16,136 KB
testcase_23 AC 71 ms
16,136 KB
testcase_24 AC 71 ms
16,136 KB
testcase_25 AC 68 ms
16,136 KB
testcase_26 AC 69 ms
16,136 KB
testcase_27 AC 69 ms
16,136 KB
testcase_28 AC 69 ms
16,136 KB
testcase_29 AC 71 ms
16,132 KB
testcase_30 AC 70 ms
16,132 KB
testcase_31 WA -
testcase_32 AC 70 ms
16,136 KB
testcase_33 AC 32 ms
10,548 KB
testcase_34 AC 44 ms
11,760 KB
testcase_35 AC 53 ms
13,404 KB
testcase_36 AC 37 ms
10,968 KB
testcase_37 AC 33 ms
10,260 KB
testcase_38 AC 38 ms
11,260 KB
testcase_39 AC 37 ms
10,968 KB
testcase_40 AC 46 ms
12,024 KB
testcase_41 AC 30 ms
10,208 KB
testcase_42 AC 40 ms
11,576 KB
testcase_43 AC 58 ms
14,400 KB
testcase_44 AC 62 ms
15,060 KB
testcase_45 AC 37 ms
10,968 KB
testcase_46 AC 40 ms
11,496 KB
testcase_47 AC 63 ms
15,064 KB
testcase_48 AC 43 ms
11,760 KB
testcase_49 AC 47 ms
12,696 KB
testcase_50 AC 50 ms
12,552 KB
testcase_51 AC 32 ms
10,444 KB
testcase_52 AC 45 ms
12,352 KB
testcase_53 AC 29 ms
10,176 KB
testcase_54 AC 30 ms
10,176 KB
testcase_55 AC 30 ms
10,180 KB
testcase_56 AC 30 ms
10,180 KB
testcase_57 AC 30 ms
10,180 KB
testcase_58 WA -
testcase_59 AC 31 ms
10,180 KB
testcase_60 WA -
testcase_61 AC 31 ms
10,180 KB
testcase_62 AC 30 ms
10,180 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))
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