結果
問題 | No.5017 Tool-assisted Shooting |
ユーザー | nyya |
提出日時 | 2023-07-16 16:18:34 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 6,502 bytes |
コンパイル時間 | 4,055 ms |
コンパイル使用メモリ | 232,664 KB |
実行使用メモリ | 34,792 KB |
スコア | 0 |
最終ジャッジ日時 | 2023-07-16 16:18:45 |
合計ジャッジ時間 | 10,437 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | TLE | - |
testcase_01 | -- | - |
testcase_02 | -- | - |
testcase_03 | -- | - |
testcase_04 | -- | - |
testcase_05 | -- | - |
testcase_06 | -- | - |
testcase_07 | -- | - |
testcase_08 | -- | - |
testcase_09 | -- | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
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 | -- | - |
testcase_64 | -- | - |
testcase_65 | -- | - |
testcase_66 | -- | - |
testcase_67 | -- | - |
testcase_68 | -- | - |
testcase_69 | -- | - |
testcase_70 | -- | - |
testcase_71 | -- | - |
testcase_72 | -- | - |
testcase_73 | -- | - |
testcase_74 | -- | - |
testcase_75 | -- | - |
testcase_76 | -- | - |
testcase_77 | -- | - |
testcase_78 | -- | - |
testcase_79 | -- | - |
testcase_80 | -- | - |
testcase_81 | -- | - |
testcase_82 | -- | - |
testcase_83 | -- | - |
testcase_84 | -- | - |
testcase_85 | -- | - |
testcase_86 | -- | - |
testcase_87 | -- | - |
testcase_88 | -- | - |
testcase_89 | -- | - |
testcase_90 | -- | - |
testcase_91 | -- | - |
testcase_92 | -- | - |
testcase_93 | -- | - |
testcase_94 | -- | - |
testcase_95 | -- | - |
testcase_96 | -- | - |
testcase_97 | -- | - |
testcase_98 | -- | - |
testcase_99 | -- | - |
ソースコード
#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; }