#pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #pragma GCC optimize("inline") #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; template string in_v_to_str (const pair v); template string v_to_str (const pair 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 string in_v_to_str (const T v) { stringstream ss; ss << v; return ss.str(); } template string v_to_str (const T v) { stringstream ss; ss << v; return ss.str(); } template string v_to_str (const array& 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 string v_to_str (const array< array, 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 string v_to_str (const vector& 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 string v_to_str (const vector< vector >& 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 string v_to_str (const set& 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 string v_to_str (const map& 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 string v_to_str (const unordered_set& 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 string v_to_str (const unordered_map& 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 string in_v_to_str (const pair v) { stringstream ss; ss << "<" << v_to_str(v.first) << ", " << v_to_str(v.second) << ">"; return ss.str(); } template string v_to_str (const pair v) { stringstream ss; ss << "<" << v_to_str(v.first) << ", " << v_to_str(v.second) << ">"; return ss.str(); } string print () { return ""; } template 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 void pdebug (const F& f, const R& ...r) { stringstream ss; ss << v_to_str(f); if (sizeof...(r) > 0) { ss << " " << print(r...); } cerr << "" << ss.str() << "" << endl; } template void fdebug (const F& f, const R& ...r) { stringstream ss; ss << v_to_str(f); if (sizeof...(r) > 0) { ss << " " << print(r...); } cerr << "" << ss.str() << "" << endl; } template void tdebug (const F& f, const R& ...r) { stringstream ss; ss << v_to_str(f); if (sizeof...(r) > 0) { ss << " " << print(r...); } cerr << "[time]" << ss.str() << "" << 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 { 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(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-1; } }; class MM { public: StopWatch sw; MM () { this->sw = StopWatch(); } int L = 1; int P = 100; char out; int X = 12; vector es; void dropDownDel (vector& 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); } 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}; bool zero = true; for (auto&& i : this->es) { for (int j = 0; j < 3; ++j) { if (i.y < 4 && i.x == dnx[j]) { dn[j] = true; } } if (this->X == i.x) { zero = false; } } this->out = 'S'; if (dn[1]) { if (dn[0] == false) { this->out = 'L'; }if (dn[2] == false) { this->out = 'R'; } } else { if (zero) { if (dn[0] == false) { this->out = 'L'; }if (dn[2] == false) { 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 = 60; 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; if (es[t].h <= 0) { this->P += es[t].p; } // cout << print(this->X, this->P, es[t].y, es[t].h) << endl; } for (auto&& i : this->es) { i.y -= 1; } // for (auto&& i : this->es) { // cout << print(i.x, i.y, i.h, i.p) << 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; }