結果

問題 No.2509 Beam Shateki
ユーザー 👑 amentorimaruamentorimaru
提出日時 2023-08-18 22:41:04
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 1,379 bytes
コンパイル時間 278 ms
コンパイル使用メモリ 86,480 KB
実行使用メモリ 83,040 KB
最終ジャッジ日時 2023-09-06 22:17:12
合計ジャッジ時間 11,551 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 93 ms
83,040 KB
testcase_01 AC 93 ms
75,896 KB
testcase_02 AC 73 ms
71,044 KB
testcase_03 AC 702 ms
77,120 KB
testcase_04 AC 684 ms
77,296 KB
testcase_05 AC 701 ms
77,248 KB
testcase_06 AC 692 ms
77,188 KB
testcase_07 AC 690 ms
77,084 KB
testcase_08 AC 689 ms
77,136 KB
testcase_09 AC 707 ms
77,140 KB
testcase_10 AC 694 ms
77,252 KB
testcase_11 AC 724 ms
77,156 KB
testcase_12 AC 712 ms
77,156 KB
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
def read_values(): return tuple(map(int, input().split()))
def read_list(): return list(read_values())

def main():
    h,w=read_values()
    a=[]
    for _ in range(h):
        a.append(read_list())
    ans=0
    st=set()
    for i in range(-1,h+1):
        st.add((i,-1))
        st.add((i,w))
    for i in range(-1,w+1):
        st.add((-1,i))
    d=[(0,1),(1,-1),(1,0),(1,1)]
    for fx,fy in st:
        for dx,dy in d:
            tmp=0
            x=fx
            y=fy
            visit=set()
            while True:
                x+=dx
                y+=dy
                if x<0 or y<0 or x>=h or y>=w:
                    break
                if not (x,y) in visit:
                    tmp+=a[x][y]
                visit.add((x,y))
            for fx2,fy2 in st:
                for dx2,dy2 in d:
                    tmp2=tmp
                    x=fx2
                    y=fy2
                    visit2=visit.copy()
                    while True:
                        x+=dx2
                        y+=dy2
                        if x<0 or y<0 or x>=h or y>=w:
                            break
                        if not (x,y) in visit2:
                            tmp2+=a[x][y]
                        visit2.add((x,y))
                    ans=max(ans,tmp2)
    print(ans)


if __name__ == "__main__":
    main()
0