結果

問題 No.5017 Tool-assisted Shooting
ユーザー nyyanyya
提出日時 2023-07-16 15:53:45
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 71 ms / 2,000 ms
コード長 5,025 bytes
コンパイル時間 3,797 ms
コンパイル使用メモリ 231,580 KB
実行使用メモリ 24,408 KB
スコア 42,220
平均クエリ数 370.74
最終ジャッジ日時 2023-07-16 15:53:59
合計ジャッジ時間 12,214 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
純コード判定しない問題か言語
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
23,652 KB
testcase_01 AC 35 ms
24,408 KB
testcase_02 AC 30 ms
23,544 KB
testcase_03 AC 40 ms
24,408 KB
testcase_04 AC 42 ms
23,676 KB
testcase_05 AC 35 ms
24,036 KB
testcase_06 AC 33 ms
24,276 KB
testcase_07 AC 38 ms
23,388 KB
testcase_08 AC 30 ms
23,664 KB
testcase_09 AC 27 ms
23,664 KB
testcase_10 AC 37 ms
23,652 KB
testcase_11 AC 31 ms
24,036 KB
testcase_12 AC 32 ms
24,132 KB
testcase_13 AC 29 ms
24,348 KB
testcase_14 AC 41 ms
23,388 KB
testcase_15 AC 27 ms
23,844 KB
testcase_16 AC 26 ms
23,640 KB
testcase_17 AC 27 ms
24,276 KB
testcase_18 AC 27 ms
23,412 KB
testcase_19 AC 31 ms
23,844 KB
testcase_20 AC 36 ms
23,412 KB
testcase_21 AC 31 ms
23,832 KB
testcase_22 AC 40 ms
23,424 KB
testcase_23 AC 60 ms
23,832 KB
testcase_24 AC 39 ms
23,676 KB
testcase_25 AC 36 ms
23,424 KB
testcase_26 AC 55 ms
24,276 KB
testcase_27 AC 29 ms
23,424 KB
testcase_28 AC 26 ms
24,372 KB
testcase_29 AC 32 ms
23,640 KB
testcase_30 AC 37 ms
24,396 KB
testcase_31 AC 60 ms
24,384 KB
testcase_32 AC 31 ms
24,060 KB
testcase_33 AC 32 ms
24,036 KB
testcase_34 AC 60 ms
24,024 KB
testcase_35 AC 47 ms
23,388 KB
testcase_36 AC 42 ms
23,640 KB
testcase_37 AC 33 ms
23,388 KB
testcase_38 AC 26 ms
23,664 KB
testcase_39 AC 68 ms
23,388 KB
testcase_40 AC 60 ms
23,664 KB
testcase_41 AC 27 ms
24,024 KB
testcase_42 AC 46 ms
24,024 KB
testcase_43 AC 33 ms
23,604 KB
testcase_44 AC 27 ms
23,388 KB
testcase_45 AC 59 ms
24,024 KB
testcase_46 AC 29 ms
23,844 KB
testcase_47 AC 33 ms
24,036 KB
testcase_48 AC 25 ms
24,060 KB
testcase_49 AC 61 ms
23,664 KB
testcase_50 AC 28 ms
24,384 KB
testcase_51 AC 33 ms
23,544 KB
testcase_52 AC 69 ms
24,024 KB
testcase_53 AC 35 ms
24,060 KB
testcase_54 AC 30 ms
23,628 KB
testcase_55 AC 43 ms
24,396 KB
testcase_56 AC 29 ms
24,408 KB
testcase_57 AC 60 ms
23,664 KB
testcase_58 AC 52 ms
23,544 KB
testcase_59 AC 30 ms
23,652 KB
testcase_60 AC 45 ms
23,844 KB
testcase_61 AC 37 ms
23,544 KB
testcase_62 AC 60 ms
24,384 KB
testcase_63 AC 30 ms
23,640 KB
testcase_64 AC 43 ms
23,556 KB
testcase_65 AC 26 ms
23,544 KB
testcase_66 AC 31 ms
23,640 KB
testcase_67 AC 68 ms
24,036 KB
testcase_68 AC 36 ms
24,024 KB
testcase_69 AC 33 ms
23,556 KB
testcase_70 AC 28 ms
23,712 KB
testcase_71 AC 38 ms
24,372 KB
testcase_72 AC 41 ms
24,036 KB
testcase_73 AC 28 ms
23,844 KB
testcase_74 AC 36 ms
24,048 KB
testcase_75 AC 32 ms
23,664 KB
testcase_76 AC 28 ms
24,036 KB
testcase_77 AC 37 ms
23,388 KB
testcase_78 AC 33 ms
23,676 KB
testcase_79 AC 42 ms
23,652 KB
testcase_80 AC 32 ms
23,532 KB
testcase_81 AC 35 ms
24,024 KB
testcase_82 AC 27 ms
24,372 KB
testcase_83 AC 32 ms
24,396 KB
testcase_84 AC 40 ms
23,424 KB
testcase_85 AC 34 ms
24,060 KB
testcase_86 AC 33 ms
23,844 KB
testcase_87 AC 36 ms
23,424 KB
testcase_88 AC 29 ms
23,388 KB
testcase_89 AC 33 ms
23,856 KB
testcase_90 AC 31 ms
23,424 KB
testcase_91 AC 28 ms
24,288 KB
testcase_92 AC 60 ms
23,640 KB
testcase_93 AC 26 ms
24,036 KB
testcase_94 AC 31 ms
23,388 KB
testcase_95 AC 28 ms
23,652 KB
testcase_96 AC 49 ms
23,436 KB
testcase_97 AC 34 ms
23,436 KB
testcase_98 AC 48 ms
24,048 KB
testcase_99 AC 30 ms
24,048 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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(){

    int MyX=12,MyY=0,S=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 + S/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;
                    }
                } 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;
                    }
                } 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;
                        } else {
                            cout << "L" << endl;
                            MyX = MyXL;
                            enemies[enemyNoL].NowHp = max(0,enemies[enemyNoL].NowHp-level);
                            if(enemies[enemyNoL].NowHp==0) S += enemies[enemyNoL].MaxHp;
                        }
                    } 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;
                    } else {
                        cout << "R" << endl;
                        MyX = MyXR;
                        enemies[enemyNoR].NowHp = max(0,enemies[enemyNoR].NowHp-level);
                        if(enemies[enemyNoR].NowHp==0) S += enemies[enemyNoR].MaxHp;
                    }
                }
            } else {
                cout << "S" << endl;
                enemies[enemyNo].NowHp = max(0,enemies[enemyNo].NowHp-level);
                if(enemies[enemyNo].NowHp==0) S += enemies[enemyNo].MaxHp;
            }
        }
        
    }

    return 0;

}
0