結果
| 問題 | No.5017 Tool-assisted Shooting | 
| コンテスト | |
| ユーザー |  FplusFplusF | 
| 提出日時 | 2023-07-16 15:01:16 | 
| 言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 76 ms / 2,000 ms | 
| コード長 | 2,136 bytes | 
| コンパイル時間 | 2,359 ms | 
| コンパイル使用メモリ | 206,568 KB | 
| 実行使用メモリ | 24,396 KB | 
| スコア | 173,334 | 
| 平均クエリ数 | 872.52 | 
| 最終ジャッジ日時 | 2023-07-16 15:01:32 | 
| 合計ジャッジ時間 | 13,754 ms | 
| ジャッジサーバーID (参考情報) | judge15 / judge12 | 
| 純コード判定しない問題か言語 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 100 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
const int INF=1e9;
using pii=pair<int,int>;
using tii=tuple<int,int,int>;
#define rep(i,n) for (int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
template<class T> void chmin(T &a,T b){
    if(a>b){
        a=b;
    }
}
template<class T> void chmax(T &a,T b){
    if(a<b){
        a=b;
    }
}
int H=60,W=25;
struct Input{
    int n;
    vector<int> h,p,x;
    void input_cin(){
        cin >> n;
        if(n==-1) exit(0);
        h.assign(n,0);
        p.assign(n,0);
        x.assign(n,0);
        rep(i,n) cin >> h[i] >> p[i] >> x[i];
    }
}Input;
struct solver{
    struct shooter{
        int j;
        int l;
        int s;
    };
    struct enemy{
        int h;
        int p;
    };
    void solve(){
        shooter me={12,1,0};
        vector<vector<enemy>> grid(H,vector<enemy>(W,{0,0})); 
        rep(t,1000){
            for(int i=H-2;0<=i;i--){
                rep(j,W){
                    grid[i+1][j]=grid[i][j];
                    grid[i][j]={0,0};
                }
            }
            Input.input_cin();
            rep(i,Input.n){
                grid[0][Input.x[i]].h=Input.h[i];
                grid[0][Input.x[i]].p=Input.p[i];
            }
            if(0<grid[H-2][me.j].h){
                if(0<=me.j-1&&grid[H-2][me.j-1].h==0){
                    cout << "L" << endl;
                    me.j--;
                }else if(me.j+1<W&&grid[H-2][me.j+1].h==0){
                    cout << "R" << endl;
                    me.j++;
                }else{
                    cout << "S" << endl;
                }
            }else{
                cout << "S" << endl;
            }
            for(int i=H-2;0<=i;i--){
                if(0<grid[i][me.j].h){
                    grid[i][me.j].h-=me.l;
                    if(grid[i][me.j].h<=0){
                        grid[i][me.j].h=0;
                        me.s+=grid[i][me.j].p;
                        grid[i][me.j].p=0;
                    }
                    break;
                }
            }
            me.l=1+me.s/100;
        }
    }
}Solver;
int main(){
    Solver.solve();
}
            
            
            
        