#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using ll = long long; using Graph = vector>; #define rep(i,x) for(ll i=0;i<(ll)(x);i++) #define rrep(i,x) for(ll i=1;i<=(ll)(x);i++) #define all(v) v.begin(),v.end() typedef pair pii; ll mod998 = 998244353; ll mod109 = 1e9 + 7; //vector> a(n,vector(n)); using mint = atcoder::modint998244353; //必要なパラメータ int my_level = 1; int my_now = 12; int point = 0; int sum = 0; //盤面情報 int h = 60; int w = 25; //power[i][j]…i,jにいる敵の現在の耐久力とパワー(first...耐久力 second...パワー) vector> power(h, vector(w)); //aim...各列で一番下方にあるやつ vector> aim(25); //string ans...i文字目はi回目の動作 string ans = ""; //盤面の更新 void reload(int n) { for (int i = 1; i < 60; i++) { for (int j = 0; j < 25; j++) { power[i - 1][j] = power[i][j]; power[i][j] = { 0,0 }; } } for (int i = 0; i < n; i++) { int t, p, x; cin >> t >> p >> x; power[59][x] = { t,p }; } for (int j = 0; j < 25; j++) { aim[j] = { 0,{0,0} }; for (int i = 0; i < 60; i++) { if (power[i][j] != make_pair(0, 0)) { aim[j] = { j,power[i][j] }; break; } } } my_level = 1 + (sum / 100); } void destination() { int ret = 1e9; int x=0, y=0; for (int j = 0; j < 25; j++) { int resist = aim[j].second.first; if (abs(my_now - j) + (resist + my_level) / my_level < aim[j].first)continue; int k = abs(my_now - j) + (resist+my_level)/my_level; if (ret > k) { x = my_now - j; y = (resist + my_level) / my_level; } } if (x > 0) { for (int i = 0; i < x; i++) { ans += 'R'; } } else if (x < 0) { for (int i = 0; i < -x; i++) { ans += 'L'; } } for (int i = 0; i < y; i++) { ans += 'S'; } } void sum_reload() { aim[my_now].second.first -= my_level; if (aim[my_now].second.first <= 0) { sum += aim[my_now].second.second; } } int main() { for (int i = 0; i < 1000; i++) { int n; cin >> n; if (n == -1) { return 0; } reload(n); char c = 0; if (ans.size() >= i + 1) { c = ans[i]; } else { destination(); if (ans.size() >= i + 1) { c = ans[i]; } else { ans = ans + 'S'; c = 'S'; } } if (c == 'L')my_now=(my_now-1+25)%25; else if (c == 'R')my_now = (my_now + 1 + 25) % 25; cout << c << endl; } }