結果

問題 No.2509 Beam Shateki
ユーザー 👑 timitimi
提出日時 2023-10-27 16:53:54
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 814 bytes
コンパイル時間 368 ms
コンパイル使用メモリ 81,828 KB
実行使用メモリ 73,288 KB
最終ジャッジ日時 2023-10-27 16:54:00
合計ジャッジ時間 5,359 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
53,636 KB
testcase_01 AC 31 ms
53,636 KB
testcase_02 AC 31 ms
53,636 KB
testcase_03 AC 45 ms
66,752 KB
testcase_04 AC 52 ms
66,752 KB
testcase_05 AC 44 ms
66,752 KB
testcase_06 AC 44 ms
66,752 KB
testcase_07 AC 46 ms
66,752 KB
testcase_08 AC 47 ms
66,752 KB
testcase_09 AC 46 ms
66,752 KB
testcase_10 AC 45 ms
66,752 KB
testcase_11 AC 46 ms
66,752 KB
testcase_12 AC 46 ms
66,752 KB
testcase_13 AC 50 ms
72,896 KB
testcase_14 AC 52 ms
72,896 KB
testcase_15 AC 50 ms
72,896 KB
testcase_16 AC 51 ms
72,896 KB
testcase_17 AC 50 ms
72,896 KB
testcase_18 AC 50 ms
72,896 KB
testcase_19 AC 56 ms
72,896 KB
testcase_20 AC 53 ms
72,896 KB
testcase_21 AC 50 ms
72,896 KB
testcase_22 AC 51 ms
72,896 KB
testcase_23 AC 58 ms
72,896 KB
testcase_24 AC 50 ms
72,896 KB
testcase_25 AC 60 ms
72,896 KB
testcase_26 AC 51 ms
72,896 KB
testcase_27 AC 51 ms
72,896 KB
testcase_28 AC 51 ms
72,896 KB
testcase_29 AC 50 ms
72,896 KB
testcase_30 AC 50 ms
72,896 KB
testcase_31 AC 50 ms
72,896 KB
testcase_32 AC 58 ms
72,896 KB
testcase_33 AC 35 ms
55,684 KB
testcase_34 AC 47 ms
66,752 KB
testcase_35 AC 48 ms
68,800 KB
testcase_36 AC 44 ms
64,704 KB
testcase_37 AC 32 ms
53,636 KB
testcase_38 AC 46 ms
66,752 KB
testcase_39 AC 54 ms
71,240 KB
testcase_40 AC 55 ms
73,288 KB
testcase_41 AC 55 ms
53,636 KB
testcase_42 AC 45 ms
66,752 KB
testcase_43 AC 49 ms
70,848 KB
testcase_44 AC 49 ms
70,848 KB
testcase_45 AC 44 ms
64,704 KB
testcase_46 AC 45 ms
66,752 KB
testcase_47 AC 49 ms
70,848 KB
testcase_48 AC 46 ms
66,752 KB
testcase_49 AC 47 ms
68,800 KB
testcase_50 AC 48 ms
68,800 KB
testcase_51 AC 34 ms
53,636 KB
testcase_52 AC 47 ms
66,752 KB
testcase_53 WA -
testcase_54 WA -
testcase_55 AC 34 ms
53,636 KB
testcase_56 AC 31 ms
53,636 KB
testcase_57 AC 33 ms
53,636 KB
testcase_58 AC 33 ms
53,636 KB
testcase_59 WA -
testcase_60 AC 35 ms
53,636 KB
testcase_61 WA -
testcase_62 WA -
testcase_63 AC 33 ms
53,636 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

H,W=map(int,input().split())
A=[]
B=[];C=[0]*W
D,E={},{}
for i in range(H):
  AA=list(map(int, input().split()))
  for j in range(W):
    C[j]+=AA[j]
    x=i+j
    if x not in D:
      D[x]=0
    y=i-j 
    if y not in E:
      E[y]=0
    D[x]+=AA[j];E[y]+=AA[j]
  A.append(AA)
  B.append(sum(AA))
if H==1 and W==1:
  print(AA[0])
  exit()
  
DD,EE=[],[]
for d in D:
  DD.append(D[d])
for e in E:
  EE.append(E[e])
BB=sorted(B)[::-1];CC=sorted(C)[::-1];DD=sorted(D)[::-1];EE=sorted(E)[::-1]
ans=0
if len(BB)>1:
  ans=max(ans,BB[0]+BB[1])
if len(CC)>1:
  ans=max(ans,CC[0]+CC[1])
if len(DD)>1:
  ans=max(ans,DD[0]+DD[1])
if len(EE)>1:
  ans=max(ans,EE[0]+EE[1])

for h in range(H):
  for w in range(W):
    a=A[h][w]
    CC=[B[h],C[w],D[h+w],E[h-w]]
    CC=sorted(CC)[::-1]
    ans=max(ans,CC[0]+CC[1]-a)
print(ans)
0