結果
問題 | No.2509 Beam Shateki |
ユーザー | GOTKAKO |
提出日時 | 2023-10-20 21:43:31 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,538 bytes |
コンパイル時間 | 2,052 ms |
コンパイル使用メモリ | 184,468 KB |
実行使用メモリ | 13,608 KB |
最終ジャッジ日時 | 2023-10-20 21:43:57 |
合計ジャッジ時間 | 9,331 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
8,696 KB |
testcase_01 | AC | 2 ms
4,348 KB |
testcase_02 | AC | 2 ms
4,348 KB |
testcase_03 | AC | 378 ms
5,128 KB |
testcase_04 | AC | 347 ms
5,128 KB |
testcase_05 | AC | 350 ms
5,128 KB |
testcase_06 | AC | 355 ms
5,128 KB |
testcase_07 | AC | 347 ms
5,128 KB |
testcase_08 | AC | 347 ms
5,128 KB |
testcase_09 | AC | 345 ms
5,128 KB |
testcase_10 | AC | 376 ms
5,128 KB |
testcase_11 | AC | 346 ms
5,128 KB |
testcase_12 | AC | 344 ms
5,128 KB |
testcase_13 | TLE | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
testcase_33 | -- | - |
testcase_34 | -- | - |
testcase_35 | -- | - |
testcase_36 | -- | - |
testcase_37 | -- | - |
testcase_38 | -- | - |
testcase_39 | -- | - |
testcase_40 | -- | - |
testcase_41 | -- | - |
testcase_42 | -- | - |
testcase_43 | -- | - |
testcase_44 | -- | - |
testcase_45 | -- | - |
testcase_46 | -- | - |
testcase_47 | -- | - |
testcase_48 | -- | - |
testcase_49 | -- | - |
testcase_50 | -- | - |
testcase_51 | -- | - |
testcase_52 | -- | - |
testcase_53 | -- | - |
testcase_54 | -- | - |
testcase_55 | -- | - |
testcase_56 | -- | - |
testcase_57 | -- | - |
testcase_58 | -- | - |
testcase_59 | -- | - |
testcase_60 | -- | - |
testcase_61 | -- | - |
testcase_62 | -- | - |
testcase_63 | -- | - |
コンパイルメッセージ
main.cpp: In function 'int main()': main.cpp:40:15: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17' [-Wc++17-extensions] 40 | auto &[s1,p1] = beam.at(i); | ^ main.cpp:42:19: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17' [-Wc++17-extensions] 42 | auto &[s2,p2] = beam.at(k); | ^ main.cpp:45:22: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17' [-Wc++17-extensions] 45 | for(auto [x,y] : s1){ | ^
ソースコード
#include <bits/stdc++.h> using namespace std; int main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); int H,W; cin >> H >> W; vector<vector<int>> A(H,vector<int>(W)); for(auto &h : A) for(auto &w : h) cin >> w; if(H == 1 && W == 1){cout << A.at(0).at(0) << endl; return 0;} vector<pair<set<pair<int,int>>,int>> beam; for(int i=0; i<H; i++){ for(int k=0; k<W; k++){ if(!(i == 0 || i == H-1 || k == 0 || k == W-1)) continue; bool one = true; for(int a=-1; a<=1; a++) for(int b=-1; b<=1; b++){ if(a == 0 && b == 0) continue; int x = i, y = k, p = 0; set<pair<int,int>> visit; while(true){ p += A.at(x).at(y); visit.insert({x,y}); x += a; y += b; if(x < 0 || x >= H || y < 0 || y >= W) break; } if(!one && visit.size() == 1) continue; if(one && visit.size() == 1) one = false; beam.push_back({visit,p}); } } } int bs = beam.size(),answer = 0; for(int i=0; i<bs; i++){ auto &[s1,p1] = beam.at(i); for(int k=i+1; k<bs; k++){ auto &[s2,p2] = beam.at(k); int now = p1+p2; for(auto [x,y] : s1){ if(s2.count(make_pair(x,y))) now -= A.at(x).at(y); } answer = max(answer,now); } } cout << answer << endl; }