結果
問題 | No.2509 Beam Shateki |
ユーザー | cho435 |
提出日時 | 2023-10-21 00:12:24 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,212 bytes |
コンパイル時間 | 7,605 ms |
コンパイル使用メモリ | 308,180 KB |
実行使用メモリ | 4,348 KB |
最終ジャッジ日時 | 2023-10-21 00:13:36 |
合計ジャッジ時間 | 66,127 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,348 KB |
testcase_01 | AC | 1 ms
4,348 KB |
testcase_02 | AC | 1 ms
4,348 KB |
testcase_03 | AC | 269 ms
4,348 KB |
testcase_04 | AC | 249 ms
4,348 KB |
testcase_05 | AC | 245 ms
4,348 KB |
testcase_06 | AC | 257 ms
4,348 KB |
testcase_07 | AC | 266 ms
4,348 KB |
testcase_08 | AC | 242 ms
4,348 KB |
testcase_09 | AC | 249 ms
4,348 KB |
testcase_10 | AC | 241 ms
4,348 KB |
testcase_11 | AC | 240 ms
4,348 KB |
testcase_12 | AC | 267 ms
4,348 KB |
testcase_13 | TLE | - |
testcase_14 | TLE | - |
testcase_15 | TLE | - |
testcase_16 | TLE | - |
testcase_17 | TLE | - |
testcase_18 | TLE | - |
testcase_19 | TLE | - |
testcase_20 | TLE | - |
testcase_21 | TLE | - |
testcase_22 | TLE | - |
testcase_23 | TLE | - |
testcase_24 | TLE | - |
testcase_25 | TLE | - |
testcase_26 | TLE | - |
testcase_27 | TLE | - |
testcase_28 | TLE | - |
testcase_29 | TLE | - |
testcase_30 | TLE | - |
testcase_31 | TLE | - |
testcase_32 | TLE | - |
testcase_33 | AC | 29 ms
4,348 KB |
testcase_34 | AC | 485 ms
4,348 KB |
testcase_35 | AC | 1,009 ms
4,348 KB |
testcase_36 | AC | 255 ms
4,348 KB |
testcase_37 | AC | 140 ms
4,348 KB |
testcase_38 | AC | 158 ms
4,348 KB |
testcase_39 | AC | 262 ms
4,348 KB |
testcase_40 | AC | 597 ms
4,348 KB |
testcase_41 | AC | 5 ms
4,348 KB |
testcase_42 | AC | 373 ms
4,348 KB |
testcase_43 | AC | 1,367 ms
4,348 KB |
testcase_44 | AC | 1,643 ms
4,348 KB |
testcase_45 | AC | 209 ms
4,348 KB |
testcase_46 | AC | 543 ms
4,348 KB |
testcase_47 | AC | 1,574 ms
4,348 KB |
testcase_48 | AC | 339 ms
4,348 KB |
testcase_49 | AC | 795 ms
4,348 KB |
testcase_50 | AC | 846 ms
4,348 KB |
testcase_51 | AC | 50 ms
4,348 KB |
testcase_52 | AC | 608 ms
4,348 KB |
testcase_53 | AC | 2 ms
4,348 KB |
testcase_54 | AC | 2 ms
4,348 KB |
testcase_55 | AC | 2 ms
4,348 KB |
testcase_56 | AC | 2 ms
4,348 KB |
testcase_57 | AC | 2 ms
4,348 KB |
testcase_58 | AC | 2 ms
4,348 KB |
testcase_59 | AC | 2 ms
4,348 KB |
testcase_60 | AC | 2 ms
4,348 KB |
testcase_61 | AC | 2 ms
4,348 KB |
testcase_62 | AC | 2 ms
4,348 KB |
testcase_63 | AC | 2 ms
4,348 KB |
ソースコード
#pragma GCC target("avx2") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include <bits/stdc++.h> #include <atcoder/all> using namespace std; using ll = long long; #define rep(i,n) for(int i=0;i<(int)(n);i++) using mint = atcoder::modint1000000007; int main(){ int h,w; cin>>h>>w; vector<vector<ll>> a(h,vector<ll>(w)); rep(i,h) rep(j,w) cin>>a[i][j]; vector<int> dx={-1,0,1,1}; vector<int> dy={1,1,1,0}; auto isok=[&](int x,int y){ return 0<=x&&x<h&&0<=y&&y<w; }; auto select=[&](int x1,int y1,int i,int x2,int y2,int j){ set<int> stl; ll res=0; while(isok(x1,y1)){ res+=a[x1][y1]; stl.insert(x1+y1*h); x1+=dx[i]; y1+=dy[i]; } while(isok(x2,y2)){ if(!stl.count(x2+y2*h)){ res+=a[x2][y2]; } x2+=dx[j]; y2+=dy[j]; } return res; }; ll ans=0; rep(ch1,h+w-1){ int x1=0,y1=0; if(ch1>=h) y1=ch1-h+1; else x1=ch1; rep(lp,2){ for(int ch2=ch1;ch2<h+w-1;ch2++){ int x2=0,y2=0; if(ch2>=h) y2=ch2-h+1; else x2=ch2; rep(rp,2){ rep(i,4){ rep(j,4){ ans=max(ans,select(x1,y1,i,x2,y2,j)); } } if(x2!=0) break; x2=h-1; } } if(x1!=0) break; x1=h-1; } } cout<<ans<<endl; }