#include #include 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; const ll INF=1LL<<60, dx[]={0,1,0,-1},dy[]={1,0,-1,0}; template inline bool chmin(T& a,const T&b) {if(a>b){a=b; return 1;} return 0;} template inline bool chmax(T& a,const T&b) {if(a P(25); //rep(i,25) cin >> P[i]; int MyX=12,MyY=0,S=0,MyPower=0; vector enemies(1); vector> colEnemy(25); int enemyNum = 0; rep(ti,T) { int n; cin >> n; if(n==-1) return 0; MyY++; //読み込み vector 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 + MyPower/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; MyPower += enemies[enemyNoR].Power; colEnemy[MyX].erase(itr); } } } 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; MyPower += enemies[enemyNoL].Power; colEnemy[MyX].erase(itl); } } } 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; MyPower += enemies[enemyNoR].Power; colEnemy[MyX].erase(itr); } } else { cout << "L" << endl; MyX = MyXL; enemies[enemyNoL].NowHp = max(0,enemies[enemyNoL].NowHp-level); if(enemies[enemyNoL].NowHp==0) { S += enemies[enemyNoL].MaxHp; MyPower += enemies[enemyNoL].Power; colEnemy[MyX].erase(itl); } } } 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; MyPower += enemies[enemyNoL].Power; colEnemy[MyX].erase(itl); } } else { cout << "R" << endl; MyX = MyXR; enemies[enemyNoR].NowHp = max(0,enemies[enemyNoR].NowHp-level); if(enemies[enemyNoR].NowHp==0) { S += enemies[enemyNoR].MaxHp; MyPower += enemies[enemyNoR].Power; colEnemy[MyX].erase(itr); } } } } else { cout << "S" << endl; enemies[enemyNo].NowHp = max(0,enemies[enemyNo].NowHp-level); if(enemies[enemyNo].NowHp==0) { S += enemies[enemyNo].MaxHp; MyPower += enemies[enemyNo].Power; colEnemy[MyX].erase(it); } cout << "#MyX,MyY:" << MyX << " " << MyY << "\n"; cout << "#EnemyNo:" << enemyNo << "\n"; cout << "#EnemyHp:" << enemies[enemyNo].NowHp << "\n"; } } } return 0; }