結果
問題 | No.2509 Beam Shateki |
ユーザー | sasa8uyauya |
提出日時 | 2023-10-20 23:07:51 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,476 bytes |
コンパイル時間 | 258 ms |
コンパイル使用メモリ | 82,248 KB |
実行使用メモリ | 82,624 KB |
最終ジャッジ日時 | 2024-09-20 22:06:13 |
合計ジャッジ時間 | 11,401 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 40 ms
55,328 KB |
testcase_01 | AC | 40 ms
53,824 KB |
testcase_02 | AC | 38 ms
53,028 KB |
testcase_03 | AC | 156 ms
78,448 KB |
testcase_04 | AC | 157 ms
78,704 KB |
testcase_05 | AC | 157 ms
78,712 KB |
testcase_06 | AC | 156 ms
78,812 KB |
testcase_07 | AC | 156 ms
78,576 KB |
testcase_08 | AC | 154 ms
78,820 KB |
testcase_09 | AC | 153 ms
78,580 KB |
testcase_10 | WA | - |
testcase_11 | AC | 156 ms
78,576 KB |
testcase_12 | AC | 156 ms
78,704 KB |
testcase_13 | AC | 210 ms
82,336 KB |
testcase_14 | AC | 209 ms
82,480 KB |
testcase_15 | AC | 210 ms
82,352 KB |
testcase_16 | AC | 208 ms
82,348 KB |
testcase_17 | AC | 214 ms
82,096 KB |
testcase_18 | AC | 210 ms
82,116 KB |
testcase_19 | AC | 211 ms
82,484 KB |
testcase_20 | WA | - |
testcase_21 | AC | 209 ms
82,376 KB |
testcase_22 | AC | 209 ms
82,244 KB |
testcase_23 | AC | 210 ms
82,248 KB |
testcase_24 | AC | 212 ms
82,168 KB |
testcase_25 | AC | 215 ms
82,124 KB |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | AC | 210 ms
82,224 KB |
testcase_29 | AC | 212 ms
82,244 KB |
testcase_30 | AC | 215 ms
82,108 KB |
testcase_31 | AC | 217 ms
82,476 KB |
testcase_32 | AC | 210 ms
82,624 KB |
testcase_33 | AC | 120 ms
77,016 KB |
testcase_34 | AC | 170 ms
79,912 KB |
testcase_35 | AC | 186 ms
80,340 KB |
testcase_36 | AC | 153 ms
78,100 KB |
testcase_37 | AC | 38 ms
53,824 KB |
testcase_38 | AC | 154 ms
78,620 KB |
testcase_39 | AC | 155 ms
78,204 KB |
testcase_40 | AC | 177 ms
79,740 KB |
testcase_41 | AC | 78 ms
74,568 KB |
testcase_42 | AC | 159 ms
79,072 KB |
testcase_43 | AC | 196 ms
80,628 KB |
testcase_44 | AC | 199 ms
81,556 KB |
testcase_45 | AC | 151 ms
78,508 KB |
testcase_46 | AC | 166 ms
79,004 KB |
testcase_47 | AC | 201 ms
81,288 KB |
testcase_48 | AC | 168 ms
79,356 KB |
testcase_49 | AC | 187 ms
80,180 KB |
testcase_50 | AC | 182 ms
80,404 KB |
testcase_51 | AC | 115 ms
77,032 KB |
testcase_52 | AC | 174 ms
79,432 KB |
testcase_53 | AC | 43 ms
60,220 KB |
testcase_54 | AC | 44 ms
60,880 KB |
testcase_55 | AC | 46 ms
59,792 KB |
testcase_56 | AC | 46 ms
61,136 KB |
testcase_57 | WA | - |
testcase_58 | AC | 47 ms
61,016 KB |
testcase_59 | AC | 48 ms
61,636 KB |
testcase_60 | AC | 46 ms
60,836 KB |
testcase_61 | AC | 46 ms
60,532 KB |
testcase_62 | WA | - |
testcase_63 | WA | - |
ソースコード
h,w=map(int,input().split()) a=[list(map(int,input().split())) for i in range(h)] if h<=2 or w<=2: g=0 for i in range(h): for j in range(w): g+=a[i][j] print(g) exit() g=0 for hanten1 in range(2): for hanten2 in range(2): for kaiten in range(4): A=[[0]*(h-1+w+h-1) for i in range(h)] for i in range(h): for j in range(w): A[i][j+h-1]=a[i][j] b1=[[0]*(h-1+w+h-1) for i in range(h)] for i in range(h): b1[i][h-1+w-1+i]=sum(A[i]) for i in range(h): for j in reversed(range(i,i+h-1+w-1)): b1[i][j]=b1[i][j+1] b2=[[0]*(h-1+w+h-1) for i in range(h)] for j in range(h-1,h-1+w+h-1): b2[h-1][j]=sum(A[h-1-i][j-i] for i in range(h)) for i in reversed(range(h-1)): for j in range(i,i+w+h-1): b2[i][j]=b2[i+1][j+1] g=max(g,sum((sorted([b1[i][h-1+w-1+i] for i in range(h)]))[::-1][:2])) g=max(g,sum((sorted([b2[h-1][h-1+i] for i in range(h+w-1)]))[::-1][:2])) for i in range(h): for j in range(i,i+h-1+w): g=max(g,b1[i][j]+b2[i][j]-A[i][j]) na=[[0]*h for i in range(w)] for i in range(h): for j in range(w): na[~j][i]=a[i][j] h,w=w,h a=na na=[[0]*w for i in range(h)] for i in range(h): for j in range(w): na[i][~j]=a[i][j] a=na na=[[0]*w for i in range(h)] for i in range(h): for j in range(w): na[~i][j]=a[i][j] a=na print(g)