結果
問題 | No.2509 Beam Shateki |
ユーザー | umimel |
提出日時 | 2023-10-20 22:28:23 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 1,223 ms / 2,000 ms |
コード長 | 2,616 bytes |
コンパイル時間 | 2,089 ms |
コンパイル使用メモリ | 180,368 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-20 20:05:56 |
合計ジャッジ時間 | 35,762 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
5,248 KB |
testcase_01 | AC | 2 ms
5,376 KB |
testcase_02 | AC | 2 ms
5,376 KB |
testcase_03 | AC | 163 ms
5,376 KB |
testcase_04 | AC | 164 ms
5,376 KB |
testcase_05 | AC | 165 ms
5,376 KB |
testcase_06 | AC | 163 ms
5,376 KB |
testcase_07 | AC | 164 ms
5,376 KB |
testcase_08 | AC | 163 ms
5,376 KB |
testcase_09 | AC | 164 ms
5,376 KB |
testcase_10 | AC | 164 ms
5,376 KB |
testcase_11 | AC | 164 ms
5,376 KB |
testcase_12 | AC | 163 ms
5,376 KB |
testcase_13 | AC | 1,217 ms
5,376 KB |
testcase_14 | AC | 1,217 ms
5,376 KB |
testcase_15 | AC | 1,219 ms
5,376 KB |
testcase_16 | AC | 1,215 ms
5,376 KB |
testcase_17 | AC | 1,217 ms
5,376 KB |
testcase_18 | AC | 1,218 ms
5,376 KB |
testcase_19 | AC | 1,217 ms
5,376 KB |
testcase_20 | AC | 1,216 ms
5,376 KB |
testcase_21 | AC | 1,216 ms
5,376 KB |
testcase_22 | AC | 1,216 ms
5,376 KB |
testcase_23 | AC | 1,217 ms
5,376 KB |
testcase_24 | AC | 1,217 ms
5,376 KB |
testcase_25 | AC | 1,215 ms
5,376 KB |
testcase_26 | AC | 1,216 ms
5,376 KB |
testcase_27 | AC | 1,216 ms
5,376 KB |
testcase_28 | AC | 1,218 ms
5,376 KB |
testcase_29 | AC | 1,214 ms
5,376 KB |
testcase_30 | AC | 1,223 ms
5,376 KB |
testcase_31 | AC | 1,218 ms
5,376 KB |
testcase_32 | AC | 1,217 ms
5,376 KB |
testcase_33 | AC | 27 ms
5,376 KB |
testcase_34 | AC | 306 ms
5,376 KB |
testcase_35 | AC | 631 ms
5,376 KB |
testcase_36 | AC | 90 ms
5,376 KB |
testcase_37 | AC | 6 ms
5,376 KB |
testcase_38 | AC | 158 ms
5,376 KB |
testcase_39 | AC | 82 ms
5,376 KB |
testcase_40 | AC | 368 ms
5,376 KB |
testcase_41 | AC | 4 ms
5,376 KB |
testcase_42 | AC | 116 ms
5,376 KB |
testcase_43 | AC | 709 ms
5,376 KB |
testcase_44 | AC | 847 ms
5,376 KB |
testcase_45 | AC | 86 ms
5,376 KB |
testcase_46 | AC | 138 ms
5,376 KB |
testcase_47 | AC | 929 ms
5,376 KB |
testcase_48 | AC | 277 ms
5,376 KB |
testcase_49 | AC | 351 ms
5,376 KB |
testcase_50 | AC | 495 ms
5,376 KB |
testcase_51 | AC | 17 ms
5,376 KB |
testcase_52 | AC | 274 ms
5,376 KB |
testcase_53 | AC | 2 ms
5,376 KB |
testcase_54 | AC | 2 ms
5,376 KB |
testcase_55 | AC | 2 ms
5,376 KB |
testcase_56 | AC | 2 ms
5,376 KB |
testcase_57 | AC | 2 ms
5,376 KB |
testcase_58 | AC | 2 ms
5,376 KB |
testcase_59 | AC | 3 ms
5,376 KB |
testcase_60 | AC | 3 ms
5,376 KB |
testcase_61 | AC | 2 ms
5,376 KB |
testcase_62 | AC | 2 ms
5,376 KB |
testcase_63 | AC | 3 ms
5,376 KB |
コンパイルメッセージ
main.cpp: In function 'void solve()': main.cpp:37:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17' [-Wc++17-extensions] 37 | for(auto [i0, j0] : E){ | ^ main.cpp:38:18: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17' [-Wc++17-extensions] 38 | for(auto [i1, j1] : E){ | ^
ソースコード
#include<bits/stdc++.h> using namespace std; using ll = long long; using pll = pair<ll, ll>; #define drep(i, cc, n) for (ll i = (cc); i <= (n); ++i) #define rep(i, n) drep(i, 0, n - 1) #define all(a) (a).begin(), (a).end() #define pb push_back #define fi first #define se second mt19937_64 rng(chrono::system_clock::now().time_since_epoch().count()); const ll MOD1000000007 = 1000000007; const ll MOD998244353 = 998244353; const ll MOD[3] = {999727999, 1070777777, 1000000007}; const ll LINF = 1LL << 60LL; const int IINF = (1 << 30) - 1; void solve(){ int h, w; cin >> h >> w; vector<vector<int>> a(h+2, vector<int>(w+2, 0)); for(int i=1; i<=h; i++) for(int j=1; j<=w; j++) cin >> a[i][j]; int ans = 0; int di[8] = {-1, -1, -1, 0, 0, 1, 1, 1}; int dj[8] = {-1, 0, 1, -1, 1, -1, 0, 1}; vector<pair<int, int>> E; for(int i=0; i<=h+1; i++) for(int j=0; j<=w+1; j++){ if(!(i==0 || i==h+1 || j==0 || j==w+1)) continue; if(i==h+1){ if(j!=0 && j!=w+1) continue; } E.pb({i, j}); } vector<vector<bool>> visited(h+2, vector<bool>(w+2, false)); for(auto [i0, j0] : E){ for(auto [i1, j1] : E){ for(int k0=0; k0<8; k0++) for(int k1=0; k1<8; k1++){ int sum = 0; { int now_i = i0, now_j = j0; while(true){ now_i = now_i + di[k0], now_j = now_j + dj[k0]; if(now_i<=0 || now_i>=h+1 || now_j<=0 || now_j>=w+1) break; sum += a[now_i][now_j]; visited[now_i][now_j] = true; } } { int now_i = i1, now_j = j1; while(true){ now_i = now_i + di[k1], now_j = now_j + dj[k1]; if(now_i<=0 || now_i>=h+1 || now_j<=0 || now_j>=w+1) break; if(!visited[now_i][now_j]) sum += a[now_i][now_j]; } } { int now_i = i0, now_j = j0; while(true){ now_i = now_i + di[k0], now_j = now_j + dj[k0]; if(now_i<=0 || now_i>=h+1 || now_j<=0 || now_j>=w+1) break; visited[now_i][now_j] = false; } } ans = max(ans, sum); } } } cout << ans << '\n'; } int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); int T=1; //cin >> T; while(T--) solve(); }