結果

問題 No.2509 Beam Shateki
ユーザー 👑 amentorimaruamentorimaru
提出日時 2023-08-18 22:55:17
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,594 ms / 2,000 ms
コード長 1,098 bytes
コンパイル時間 293 ms
コンパイル使用メモリ 87,232 KB
実行使用メモリ 79,540 KB
最終ジャッジ日時 2023-09-06 22:17:53
合計ジャッジ時間 46,430 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
75,920 KB
testcase_01 AC 77 ms
76,040 KB
testcase_02 AC 68 ms
71,244 KB
testcase_03 AC 288 ms
77,500 KB
testcase_04 AC 278 ms
77,408 KB
testcase_05 AC 275 ms
77,100 KB
testcase_06 AC 275 ms
77,464 KB
testcase_07 AC 281 ms
77,100 KB
testcase_08 AC 273 ms
77,416 KB
testcase_09 AC 273 ms
77,420 KB
testcase_10 AC 276 ms
77,132 KB
testcase_11 AC 274 ms
77,412 KB
testcase_12 AC 274 ms
77,460 KB
testcase_13 AC 1,568 ms
79,180 KB
testcase_14 AC 1,594 ms
78,928 KB
testcase_15 AC 1,568 ms
79,460 KB
testcase_16 AC 1,573 ms
78,924 KB
testcase_17 AC 1,575 ms
79,180 KB
testcase_18 AC 1,578 ms
78,956 KB
testcase_19 AC 1,569 ms
79,300 KB
testcase_20 AC 1,574 ms
79,152 KB
testcase_21 AC 1,567 ms
79,540 KB
testcase_22 AC 1,570 ms
79,232 KB
testcase_23 AC 1,573 ms
79,180 KB
testcase_24 AC 1,571 ms
78,960 KB
testcase_25 AC 1,572 ms
79,232 KB
testcase_26 AC 1,574 ms
79,264 KB
testcase_27 AC 1,573 ms
78,920 KB
testcase_28 AC 1,569 ms
79,388 KB
testcase_29 AC 1,575 ms
79,180 KB
testcase_30 AC 1,574 ms
79,256 KB
testcase_31 AC 1,583 ms
79,180 KB
testcase_32 AC 1,574 ms
79,416 KB
testcase_33 AC 111 ms
76,716 KB
testcase_34 AC 438 ms
77,696 KB
testcase_35 AC 787 ms
78,348 KB
testcase_36 AC 218 ms
77,280 KB
testcase_37 AC 91 ms
76,488 KB
testcase_38 AC 242 ms
77,376 KB
testcase_39 AC 203 ms
77,336 KB
testcase_40 AC 501 ms
77,908 KB
testcase_41 AC 84 ms
75,960 KB
testcase_42 AC 256 ms
77,212 KB
testcase_43 AC 942 ms
78,548 KB
testcase_44 AC 1,129 ms
78,944 KB
testcase_45 AC 201 ms
76,916 KB
testcase_46 AC 311 ms
77,644 KB
testcase_47 AC 1,162 ms
78,732 KB
testcase_48 AC 375 ms
77,564 KB
testcase_49 AC 534 ms
78,028 KB
testcase_50 AC 692 ms
78,060 KB
testcase_51 AC 106 ms
76,676 KB
testcase_52 AC 452 ms
78,048 KB
testcase_53 AC 76 ms
75,888 KB
testcase_54 AC 76 ms
75,876 KB
testcase_55 AC 77 ms
75,656 KB
testcase_56 AC 79 ms
75,964 KB
testcase_57 AC 79 ms
75,988 KB
testcase_58 AC 78 ms
75,944 KB
testcase_59 AC 77 ms
75,808 KB
testcase_60 AC 79 ms
75,656 KB
testcase_61 AC 77 ms
76,116 KB
testcase_62 AC 79 ms
75,920 KB
testcase_63 AC 78 ms
75,900 KB
権限があれば一括ダウンロードができます

ソースコード

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)]
    l=[]
    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))
            l.append((tmp,visit))
    for score,visit in l:
        for score2,visit2 in l:
            tmp=score+score2
            for v in visit:
                if v in visit2:
                    tmp-=a[v[0]][v[1]]
            ans=max(ans,tmp)
    print(ans)


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