結果

問題 No.2509 Beam Shateki
ユーザー hato336hato336
提出日時 2023-10-20 21:52:44
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,150 bytes
コンパイル時間 234 ms
コンパイル使用メモリ 81,796 KB
実行使用メモリ 80,648 KB
最終ジャッジ日時 2023-10-20 21:52:54
合計ジャッジ時間 9,622 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 57 ms
64,144 KB
testcase_01 AC 50 ms
61,856 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 TLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
testcase_52 -- -
testcase_53 -- -
testcase_54 -- -
testcase_55 -- -
testcase_56 -- -
testcase_57 -- -
testcase_58 -- -
testcase_59 -- -
testcase_60 -- -
testcase_61 -- -
testcase_62 -- -
testcase_63 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
h,w = map(int,input().split())
grid = []
for i in range(h):
    grid.append(list(map(int,input().split())))

ans = 0
dxy = [[-1,-1],[-1,0],[-1,1],[0,-1],[0,1],[1,-1],[1,0],[1,1]]

s = set()
for i in [0,h]:
    for j in range(w+2):
        s.add((i,j))

for i in [0,w]:
    for j in range(h+2):
        s.add((j,i))

for x,y in s:
    for dx,dy in dxy:
        temp = 1
        cnt = 0
        se = set()
        while 1 <= x+dx*temp <= h and 1 <= y+dy*temp <= w:
            cnt += grid[x+dx*temp-1][y+dy*temp-1]
            se.add((x+dx*temp-1,y+dy*temp-1))
            temp += 1
        if temp == 1:
            break
        
        for u,v in s:
            if x == u and y == v:
                continue
            for dx,dy in dxy:
                c = 0
                temp = 1
                while 1 <= u+dx*temp <= h and 1 <= v+dy*temp <= w:
                    if (u+dx*temp-1,v+dy*temp-1) in se:
                        temp += 1
                        continue
                    c += grid[u+dx*temp-1][v+dy*temp-1]
                    temp += 1
                ans = max(ans,cnt+c)
print(ans)
0