結果
問題 | No.5017 Tool-assisted Shooting |
ユーザー | nyya |
提出日時 | 2023-07-16 16:23:40 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 66 ms / 2,000 ms |
コード長 | 6,506 bytes |
コンパイル時間 | 3,866 ms |
コンパイル使用メモリ | 232,696 KB |
実行使用メモリ | 24,492 KB |
スコア | 227,180 |
平均クエリ数 | 2184.95 |
最終ジャッジ日時 | 2023-07-16 16:23:55 |
合計ジャッジ時間 | 14,778 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
純コード判定しない問題か言語 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 66 ms
23,544 KB |
testcase_01 | AC | 63 ms
23,664 KB |
testcase_02 | AC | 63 ms
23,424 KB |
testcase_03 | AC | 63 ms
23,640 KB |
testcase_04 | AC | 62 ms
24,060 KB |
testcase_05 | AC | 63 ms
24,024 KB |
testcase_06 | AC | 64 ms
23,640 KB |
testcase_07 | AC | 37 ms
23,544 KB |
testcase_08 | AC | 63 ms
23,556 KB |
testcase_09 | AC | 64 ms
23,844 KB |
testcase_10 | AC | 63 ms
23,400 KB |
testcase_11 | AC | 32 ms
23,376 KB |
testcase_12 | AC | 62 ms
24,348 KB |
testcase_13 | AC | 63 ms
24,036 KB |
testcase_14 | AC | 63 ms
23,532 KB |
testcase_15 | AC | 63 ms
23,712 KB |
testcase_16 | AC | 62 ms
23,640 KB |
testcase_17 | AC | 64 ms
23,652 KB |
testcase_18 | AC | 64 ms
23,676 KB |
testcase_19 | AC | 63 ms
24,264 KB |
testcase_20 | AC | 63 ms
24,036 KB |
testcase_21 | AC | 64 ms
24,348 KB |
testcase_22 | AC | 49 ms
23,688 KB |
testcase_23 | AC | 62 ms
23,376 KB |
testcase_24 | AC | 63 ms
24,372 KB |
testcase_25 | AC | 64 ms
23,664 KB |
testcase_26 | AC | 53 ms
24,264 KB |
testcase_27 | AC | 63 ms
23,424 KB |
testcase_28 | AC | 63 ms
24,024 KB |
testcase_29 | AC | 62 ms
24,036 KB |
testcase_30 | AC | 37 ms
24,408 KB |
testcase_31 | AC | 63 ms
23,388 KB |
testcase_32 | AC | 64 ms
24,036 KB |
testcase_33 | AC | 64 ms
24,336 KB |
testcase_34 | AC | 63 ms
24,012 KB |
testcase_35 | AC | 63 ms
23,556 KB |
testcase_36 | AC | 62 ms
23,856 KB |
testcase_37 | AC | 63 ms
24,060 KB |
testcase_38 | AC | 64 ms
24,384 KB |
testcase_39 | AC | 64 ms
23,544 KB |
testcase_40 | AC | 63 ms
23,664 KB |
testcase_41 | AC | 63 ms
24,036 KB |
testcase_42 | AC | 63 ms
23,436 KB |
testcase_43 | AC | 62 ms
23,664 KB |
testcase_44 | AC | 63 ms
24,036 KB |
testcase_45 | AC | 63 ms
24,492 KB |
testcase_46 | AC | 64 ms
24,408 KB |
testcase_47 | AC | 63 ms
23,436 KB |
testcase_48 | AC | 63 ms
23,424 KB |
testcase_49 | AC | 62 ms
23,676 KB |
testcase_50 | AC | 64 ms
24,036 KB |
testcase_51 | AC | 64 ms
24,012 KB |
testcase_52 | AC | 63 ms
24,072 KB |
testcase_53 | AC | 62 ms
24,036 KB |
testcase_54 | AC | 63 ms
24,384 KB |
testcase_55 | AC | 46 ms
24,036 KB |
testcase_56 | AC | 62 ms
23,844 KB |
testcase_57 | AC | 63 ms
23,988 KB |
testcase_58 | AC | 62 ms
23,544 KB |
testcase_59 | AC | 63 ms
23,424 KB |
testcase_60 | AC | 62 ms
23,388 KB |
testcase_61 | AC | 63 ms
23,544 KB |
testcase_62 | AC | 64 ms
23,424 KB |
testcase_63 | AC | 63 ms
23,652 KB |
testcase_64 | AC | 64 ms
23,532 KB |
testcase_65 | AC | 64 ms
24,036 KB |
testcase_66 | AC | 63 ms
23,424 KB |
testcase_67 | AC | 63 ms
23,652 KB |
testcase_68 | AC | 51 ms
23,424 KB |
testcase_69 | AC | 63 ms
24,276 KB |
testcase_70 | AC | 64 ms
23,388 KB |
testcase_71 | AC | 63 ms
23,412 KB |
testcase_72 | AC | 63 ms
23,556 KB |
testcase_73 | AC | 64 ms
23,412 KB |
testcase_74 | AC | 62 ms
24,036 KB |
testcase_75 | AC | 64 ms
23,400 KB |
testcase_76 | AC | 64 ms
24,048 KB |
testcase_77 | AC | 64 ms
23,388 KB |
testcase_78 | AC | 35 ms
23,832 KB |
testcase_79 | AC | 63 ms
23,664 KB |
testcase_80 | AC | 33 ms
23,424 KB |
testcase_81 | AC | 65 ms
23,856 KB |
testcase_82 | AC | 63 ms
23,628 KB |
testcase_83 | AC | 63 ms
23,412 KB |
testcase_84 | AC | 63 ms
23,676 KB |
testcase_85 | AC | 64 ms
23,544 KB |
testcase_86 | AC | 63 ms
23,844 KB |
testcase_87 | AC | 63 ms
24,348 KB |
testcase_88 | AC | 63 ms
23,376 KB |
testcase_89 | AC | 39 ms
24,336 KB |
testcase_90 | AC | 64 ms
23,628 KB |
testcase_91 | AC | 65 ms
24,072 KB |
testcase_92 | AC | 63 ms
23,640 KB |
testcase_93 | AC | 65 ms
23,628 KB |
testcase_94 | AC | 33 ms
24,396 KB |
testcase_95 | AC | 64 ms
23,664 KB |
testcase_96 | AC | 64 ms
24,012 KB |
testcase_97 | AC | 64 ms
23,652 KB |
testcase_98 | AC | 64 ms
24,036 KB |
testcase_99 | AC | 62 ms
23,640 KB |
ソースコード
#include <bits/stdc++.h> #include <atcoder/all> using namespace std; using namespace atcoder; #define rep(i,n) for(int i=0;i<(n);i++) #define all(x) x.begin(),x.end() typedef long long ll; //using mint = modint; //using mint = modint998244353; using mint = modint1000000007; using P = pair<int, int>; const ll INF=1LL<<60, dx[]={0,1,0,-1},dy[]={1,0,-1,0}; template <typename T> inline bool chmin(T& a,const T&b) {if(a>b){a=b; return 1;} return 0;} template <typename T> inline bool chmax(T& a,const T&b) {if(a<b){a=b; return 1;} return 0;} const int W = 25; const int H = 60; const int T = 1000; class Enemy { public: int MaxHp; int NowHp; int Power; }; int Field[25][1070]; int main(){ //vector<int> P(25); //rep(i,25) cin >> P[i]; int MyX=12,MyY=0,S=0,MyPower=0; vector<Enemy> enemies(1); vector<vector<int>> colEnemy(25); int enemyNum = 0; rep(ti,T) { int n; cin >> n; if(n==-1) return 0; MyY++; //読み込み vector<int> h(n),p(n),x(n); rep(i,n) { enemyNum++; cin >> h[i] >> p[i] >> x[i]; auto enemy = Enemy(); enemy.MaxHp = h[i]; enemy.NowHp = h[i]; enemy.Power = p[i]; Field[x[i]][ti+H] = enemyNum; enemies.push_back(enemy); colEnemy[x[i]].push_back(ti+H); } //選択 int level = 1 + MyPower/100; auto it = lower_bound(colEnemy[MyX].begin(),colEnemy[MyX].end(),MyY); if(it==colEnemy[MyX].end()) cout << "S" << endl; else { int enemyNo = Field[MyX][*it]; if(enemies[enemyNo].NowHp>(*it-MyY)*level) { int MyXL = (MyX+24)%25; int MyXR = (MyX+ 1)%25; auto itl = lower_bound(colEnemy[MyXL].begin(),colEnemy[MyXL].end(),MyY); auto itr = lower_bound(colEnemy[MyXR].begin(),colEnemy[MyXR].end(),MyY); if(itl==colEnemy[MyXL].end() && itr==colEnemy[MyXR].end()) { cout << "L" << endl; MyX = MyXL; } else if(itl==colEnemy[MyXL].end() && itr!=colEnemy[MyXR].end()) { int enemyNoR = Field[MyXR][*itr]; if(enemies[enemyNoR].NowHp>(*itr-MyY)*level) { cout << "L" << endl; MyX = MyXL; } else { cout << "R" << endl; MyX = MyXR; enemies[enemyNoR].NowHp = max(0,enemies[enemyNoR].NowHp-level); if(enemies[enemyNoR].NowHp==0) { S += enemies[enemyNoR].MaxHp; MyPower += enemies[enemyNoR].Power; colEnemy[MyX].erase(itr); } } } else if(itl!=colEnemy[MyXL].end() && itr==colEnemy[MyXR].end()) { int enemyNoL = Field[MyXL][*itl]; if(enemies[enemyNoL].NowHp>(*itl-MyY)*level) { cout << "R" << endl; MyX = MyXR; } else { cout << "L" << endl; MyX = MyXL; enemies[enemyNoL].NowHp = max(0,enemies[enemyNoL].NowHp-level); if(enemies[enemyNoL].NowHp==0) { S += enemies[enemyNoL].MaxHp; MyPower += enemies[enemyNoL].Power; colEnemy[MyX].erase(itl); } } } else { int enemyNoR = Field[MyXR][*itr]; int enemyNoL = Field[MyXL][*itl]; if(enemies[enemyNoR].NowHp>(*itr-MyY)*level && enemies[enemyNoL].NowHp>(*itl-MyY)*level) { if(*itr>*itl) { cout << "R" << endl; MyX = MyXR; enemies[enemyNoR].NowHp = max(0,enemies[enemyNoR].NowHp-level); if(enemies[enemyNoR].NowHp==0) { S += enemies[enemyNoR].MaxHp; MyPower += enemies[enemyNoR].Power; colEnemy[MyX].erase(itr); } } else { cout << "L" << endl; MyX = MyXL; enemies[enemyNoL].NowHp = max(0,enemies[enemyNoL].NowHp-level); if(enemies[enemyNoL].NowHp==0) { S += enemies[enemyNoL].MaxHp; MyPower += enemies[enemyNoL].Power; colEnemy[MyX].erase(itl); } } } else if(enemies[enemyNoR].NowHp>(*itr-MyY)*level){ cout << "L" << endl; MyX = MyXL; enemies[enemyNoL].NowHp = max(0,enemies[enemyNoL].NowHp-level); if(enemies[enemyNoL].NowHp==0) { S += enemies[enemyNoL].MaxHp; MyPower += enemies[enemyNoL].Power; colEnemy[MyX].erase(itl); } } else { cout << "R" << endl; MyX = MyXR; enemies[enemyNoR].NowHp = max(0,enemies[enemyNoR].NowHp-level); if(enemies[enemyNoR].NowHp==0) { S += enemies[enemyNoR].MaxHp; MyPower += enemies[enemyNoR].Power; colEnemy[MyX].erase(itr); } } } } else { cout << "S" << endl; enemies[enemyNo].NowHp = max(0,enemies[enemyNo].NowHp-level); if(enemies[enemyNo].NowHp==0) { S += enemies[enemyNo].MaxHp; MyPower += enemies[enemyNo].Power; colEnemy[MyX].erase(it); } cout << "#MyX,MyY:" << MyX << " " << MyY << "\n"; cout << "#EnemyNo:" << enemyNo << "\n"; cout << "#EnemyHp:" << enemies[enemyNo].NowHp << "\n"; } } } return 0; }