結果
問題 | No.5017 Tool-assisted Shooting |
ユーザー |
|
提出日時 | 2023-07-16 16:07:19 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 65 ms / 2,000 ms |
コード長 | 2,618 bytes |
コンパイル時間 | 4,350 ms |
コンパイル使用メモリ | 271,944 KB |
実行使用メモリ | 24,420 KB |
スコア | 2,717,285 |
平均クエリ数 | 1099.76 |
最終ジャッジ日時 | 2023-07-16 16:07:34 |
合計ジャッジ時間 | 15,108 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge13 |
純コード判定しない問題か言語 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 100 |
ソースコード
// #define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; #include <atcoder/all> using namespace atcoder; using ll = long long; #define rep(i,n) for (ll i = 0; i < (n); ++i) using vl = vector<ll>; using vvl = vector<vl>; using P = pair<ll,ll>; #define pb push_back #define int long long #define double long double #define INF (ll) 3e18 // Ctrl + Shift + B コンパイル // Ctrl + C 中断 // ./m 実行 int h = 60; int w = 25; // フィールドはトーラス状であり、左端と右端は繋がっている int now = 12; int power = 100; // 倒して得たパワーの総和 int debug = 0; vector<vector<P>> hp(60, vector<P>(25)); vector<vector<tuple<int,int,int>>> in(1000); vl p(25); void debug_input(){ rep(i,25) cin >> p[i]; rep(i,1000){ int n; cin >> n; rep(_,n){ int h, p, w; cin >> h >> p >> w; in[i].emplace_back(h,p,w); } } cout << "debug input finish" << endl; } bool input(int turn){ for(int j = 59; j >= 1; j--) hp[j] = hp[j-1]; hp[0] = vector<P>(25); if(debug){ for(auto[h, p, x] : in[turn]){ hp[0][x] = make_pair(h, p); } return false; } int n; cin >> n; if (n == -1) return true; rep(i,n){ int h, p, x; cin >> h >> p >> x; hp[0][x] = make_pair(h, p); } return false; } void attack(){ cout << "S" << endl; for(int i = 58; i >= 0; i--){ if (hp[i][now].first){ hp[i][now].first = max(0LL, hp[i][now].first-power/100); if (hp[i][now].first == 0){ // 倒したら hp[i][now].first = 0; power += hp[i][now].second; } return; } } } void avoid(){ if (!hp[58][(now+1)%25].first && !hp[59][(now+1)%25].first) {cout << "R" << endl; now += 1;} else if (!hp[58][now].first) cout << "S" << endl; else {cout << "L" << endl; now += 24;} now %= 25; cout << "# " << now << endl; } void solve(){ rep(turn, 1000){ if (input(turn)) return; // if (turn == 385){ // for(auto x : hp){ // for(auto [h, p] : x) if (h) cout << "#"; else cout << "."; // cout << endl; // } // } // 操作を行う // まずは動かない場合に衝突するとき回避したい if (hp[58][now].first){ if (hp[58][now].first <= power/100) {attack(); continue;} else {avoid(); continue;} } int check = 0; for(int i = 58; i >= 0; i--){ if (hp[i][now].first){ check = 1; if (hp[i][now].first > (59-i)*(power/100)){avoid(); break;} else {attack(); break;} } } if(check) continue; avoid(); } } signed main(){ if (debug) debug_input(); solve(); }