結果

問題 No.5017 Tool-assisted Shooting
ユーザー ebicochinealebicochineal
提出日時 2023-07-16 16:06:41
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 62 ms / 2,000 ms
コード長 8,725 bytes
コンパイル時間 1,410 ms
コンパイル使用メモリ 116,408 KB
実行使用メモリ 24,396 KB
スコア 149,867
平均クエリ数 812.94
最終ジャッジ日時 2023-07-16 16:07:00
合計ジャッジ時間 11,231 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
純コード判定しない問題か言語
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("inline")

#include <cmath>
#include <string>
#include <array>
#include <vector>
#include <cstdlib>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <limits>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <bitset>
#include <chrono>
using namespace std;

template<class F, class S> string in_v_to_str (const pair<F, S> v);
template<class F, class S> string v_to_str (const pair<F, S> v);
string in_v_to_str (const char v) { return "'" + string{v} + "'"; }
string in_v_to_str (const char* v) { return "\"" + string(v) + "\""; }
string in_v_to_str (const string v) { return "\"" + v + "\""; }
template<class T> string in_v_to_str (const T v) { stringstream ss; ss << v; return ss.str(); }
template<class T> string v_to_str (const T v) { stringstream ss; ss << v; return ss.str(); }
template<class T, size_t N> string v_to_str (const array<T, N>& v) { stringstream ss; if (v.size() > 0) { ss << "["; for (size_t i = 0; i < v.size() - 1; ++i) { ss << in_v_to_str(v[i]) << ", "; } ss << in_v_to_str(v[v.size() - 1]) << "]"; } else { ss << "[]"; } return ss.str(); }
template<class T, size_t N> string v_to_str (const array< array<T, N>, N >& v) { stringstream ss; if (v.size() > 0) { ss << "["; for (size_t i = 0; i < v.size() - 1; ++i) { ss << v_to_str(v[i]) << ", "; } ss << v_to_str(v[v.size() - 1]) << "]"; } else { ss << "[-]"; } return ss.str(); }
template<class T> string v_to_str (const vector<T>& v) { stringstream ss; if (v.size() > 0) { ss << "["; for (size_t i = 0; i < v.size() - 1; ++i) { ss << in_v_to_str(v[i]) << ", "; } ss << in_v_to_str(v[v.size() - 1]) << "]"; } else { ss << "[]"; } return ss.str(); }
template<class T> string v_to_str (const vector< vector<T> >& v) { stringstream ss; if (v.size() > 0) { ss << "["; for (size_t i = 0; i < v.size() - 1; ++i) { ss << v_to_str(v[i]) << ", "; } ss << v_to_str(v[v.size() - 1]) << "]"; } else { ss << "[-]"; } return ss.str(); }
template<class T> string v_to_str (const set<T>& v) { stringstream ss; int len = v.size(); ss << (v.size() > 0 ? "{" : "{}"); for (auto& i : v) { ss << in_v_to_str(i) << (len-- > 1 ? ", " : "}"); } return ss.str(); }
template<class K, class V> string v_to_str (const map<K, V>& v) { stringstream ss; int len = v.size(); ss << (v.size() > 0 ? "{" : "{}"); for (auto& i : v) { ss << in_v_to_str(i.first) << " : " << in_v_to_str(i.second) << (len-- > 1 ? ", " : "}"); } return ss.str(); }
template<class T> string v_to_str (const unordered_set<T>& v) { stringstream ss; int len = v.size(); ss << (v.size() > 0 ? "{" : "{}"); for (auto& i : v) { ss << in_v_to_str(i) << (len-- > 1 ? ", " : "}"); } return ss.str(); }
template<class K, class V> string v_to_str (const unordered_map<K, V>& v) { stringstream ss; int len = v.size(); ss << (v.size() > 0 ? "{" : "{}"); for (auto& i : v) { ss << in_v_to_str(i.first) << " : " << in_v_to_str(i.second) << (len-- > 1 ? ", " : "}"); } return ss.str(); }
template<class F, class S> string in_v_to_str (const pair<F, S> v) { stringstream ss; ss << "<" << v_to_str(v.first) << ", " << v_to_str(v.second) << ">"; return ss.str(); }
template<class F, class S> string v_to_str (const pair<F, S> v) { stringstream ss; ss << "<" << v_to_str(v.first) << ", " << v_to_str(v.second) << ">"; return ss.str(); }
string print () { return ""; }
template<typename F, typename... R> string print (const F& f, const R& ...r) { stringstream ss; ss << v_to_str(f); if (sizeof...(r) > 0) { ss << " " << print(r...); } return ss.str(); }

template<typename F, typename... R> void pdebug (const F& f, const R& ...r) {
    stringstream ss;
    ss << v_to_str(f); if (sizeof...(r) > 0) { ss << " " << print(r...); }
    cerr << "<cerr>" << ss.str() << "</cerr>" << endl;
}

template<typename F, typename... R> void fdebug (const F& f, const R& ...r) {
    stringstream ss;
    ss << v_to_str(f); if (sizeof...(r) > 0) { ss << " " << print(r...); }
    cerr << "<cerrfile>" << ss.str() << "</cerrfile>" << endl;
}

template<typename F, typename... R> void tdebug (const F& f, const R& ...r) {
    stringstream ss;
    ss << v_to_str(f); if (sizeof...(r) > 0) { ss << " " << print(r...); }
    cerr << "<cerr>[time]" << ss.str() << "</cerr>" << endl;
}



struct e512pos {
public:
    int x;
    int y;
    e512pos () { this->x = 0; this->y = 0; }
    e512pos (int x, int y) {
        this->x = x;
        this->y = y;
    }
    e512pos operator + (const e512pos& t) { return e512pos(this->x + t.x, this->y + t.y); }
    e512pos operator - (const e512pos& t) { return e512pos(this->x - t.x, this->y - t.y); }
    bool operator == (const e512pos& t) const { return this->x == t.x && this->y == t.y; }
};
namespace std {
    template <> class hash<e512pos> {
    public:
        size_t operator()(const e512pos& t) const{ return t.x<<16 | t.y; }
    };
}
ostream& operator << (ostream& os, const e512pos& p) {
    os << "(" << p.x << ", " << p.y << ")";
    return os;
};


class StopWatch {
public:
    std::chrono::system_clock::time_point start, tstart, end;
    StopWatch () {
        this->start = std::chrono::system_clock::now();
    }
    inline void stop () {
        this->tstart = std::chrono::system_clock::now();
    }
    inline void resume () {
        this->start += std::chrono::system_clock::now() - this->tstart;
    }
    inline uint64_t get_milli_time () {
        this->end = std::chrono::system_clock::now();
        return std::chrono::duration_cast<std::chrono::milliseconds>(end-start).count();
    }
};



inline uint32_t xrnd() {
    static uint32_t y = 2463534242;
    y = y ^ (y << 13);
    y = y ^ (y >> 17);
    return y = y ^ (y << 5);
}

constexpr int width = 25;  // フィールドの幅
constexpr int height = 60; // フィールドの高さ
constexpr int max_turn = 1000; // ゲームの最大ターン数


struct E {
    int x, y, h, p;
    E (int x, int h, int p) {
        this->x = x;
        this->h = h;
        this->p = p;
        this->y = height;
    }
};


class MM {
public:
    StopWatch sw;
    MM () { this->sw = StopWatch(); }
    int L = 1;
    int P = 0;
    char out;
    int X = 12;
    vector<E> es;
    void dropDownDel (vector<E>& v) {
        int l = 0;
        for (int i = 0; i < v.size(); ++i) {
            if (v[i].y == 0 || v[i].h <= 0) {
            } else {
                swap(v[i], v[l]);
                l += 1;
            }
        }
        int d = v.size() - l;
        for (int i = 0; i < d; ++i) {
            v.pop_back();
        }
    }
    void input () {
        for(int turn = 1; turn <= max_turn; turn++) {
            int n;
            cin >> n;
            if(n == -1) { return; }
            for(int i = 0; i < n; i++) {
                int h, p, x;
                std::cin >> h >> p >> x;
                this->es.emplace_back(x, h, p);
            }
            
            for (auto&& i : this->es) {
                i.y -= 1;
            }
            this->dropDownDel(this->es);
            
            bool dn[] = {false, false, false};
            int dnx[] = {this->X-1 < 0 ? width-1 : this->X-1, this->X, this->X+1 >= width ? 0 : this->X+1};
            
            
            for (auto&& i : this->es) {
                for (int j = 0; j < 3; ++j) {
                    if (i.y < 5 && i.x == dnx[j]) {
                        dn[j] = true;
                    }
                }
            }
            
            
            this->out = 'S';
            if (dn[1]) {
                if (dn[0] == false) {
                    this->out = 'L';
                } else {
                    this->out = 'R';
                }
            }
            
            if (this->out == 'L') { this->X = dnx[0]; }
            if (this->out == 'S') { this->X = dnx[1]; }
            if (this->out == 'R') { this->X = dnx[2]; }
            
            int d = 1000;
            int t = -1;
            for (int i = 0; i < es.size(); ++i) {
                if (es[i].x == this->X && es[i].y < d) {
                    d = es[i].y;
                    t = i;
                }
            }
            if (t >= 0) {
                es[t].h -= this->P/100+this->L;
                if (es[t].h <= 0) { this->P += es[t].p; }
                // cout << print(this->X, es[t].y, es[t].h) << endl;
            }
            
            
            this->solve();
            this->output();
        }
    }
    
    void output () {
        cout << this->out << endl;
    }
    void solve () {
        
        
        
    }
};


int main () {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    MM mm;
    mm.input();
    cout.flush();
    return 0;
}
0