// #define _GLIBCXX_DEBUG #include using namespace std; #include using namespace atcoder; using ll = long long; #define rep(i,n) for (ll i = 0; i < (n); ++i) using vl = vector; using vvl = vector; using P = pair; #define pb push_back #define int long long #define double long double #define INF (ll) 3e18 // Ctrl + Shift + B コンパイル // Ctrl + C 中断 // ./m 実行 int h = 60; int w = 25; // フィールドはトーラス状であり、左端と右端は繋がっている int now = 12; int power = 100; // 倒して得たパワーの総和 int debug = 0; vector> hp(60, vector

(25)); vector>> in(1000); vl p(25); void debug_input(){ rep(i,25) cin >> p[i]; rep(i,1000){ int n; cin >> n; rep(_,n){ int h, p, w; cin >> h >> p >> w; in[i].emplace_back(h,p,w); } } cout << "debug input finish" << endl; } bool input(int turn){ for(int j = 59; j >= 1; j--) hp[j] = hp[j-1]; hp[0] = vector

(25); if(debug){ for(auto[h, p, x] : in[turn]){ hp[0][x] = make_pair(h, p); } return false; } int n; cin >> n; if (n == -1) return true; rep(i,n){ int h, p, x; cin >> h >> p >> x; hp[0][x] = make_pair(h, p); } return false; } void attack(){ cout << "S" << endl; for(int i = 58; i >= 0; i--){ if (hp[i][now].first){ hp[i][now].first = max(0LL, hp[i][now].first-power/100); if (hp[i][now].first == 0){ // 倒したら hp[i][now].first = 0; power += hp[i][now].second; } return; } } } void moveL(){ cout << "L" << endl; now += 24; now %= 25; for(int i = 58; i >= 0; i--){ if (hp[i][now].first){ hp[i][now].first = max(0LL, hp[i][now].first-power/100); if (hp[i][now].first == 0){ // 倒したら hp[i][now].first = 0; power += hp[i][now].second; } return; } } } void moveR(){ cout << "R" << endl; now += 1; now %= 25; for(int i = 58; i >= 0; i--){ if (hp[i][now].first){ hp[i][now].first = max(0LL, hp[i][now].first-power/100); if (hp[i][now].first == 0){ // 倒したら hp[i][now].first = 0; power += hp[i][now].second; } return; } } } void avoid(){ if (!hp[58][(now+1)%25].first && !hp[59][(now+1)%25].first) {cout << "R" << endl; now += 1;} else if (!hp[58][now].first) cout << "S" << endl; else {cout << "L" << endl; now += 24;} now %= 25; cout << "# " << now << endl; } void deb(){ cout << "# "; cout << "now potision is " << now << endl; for(int i = 58; i >= 0; i--){ if (hp[i][now].first){ cout << "# "; cout << "closest enemy is " << now << " " << 59-i << endl; cout << "# "; cout << "enemy stat : " << hp[i][now].first << " " << hp[i][now].second << endl; break; } } } void solve(){ rep(turn, 1000){ // cout << turn << endl; // cout << now << endl; if (input(turn)) return; vector> beams; // ビームサーチ // if (turn == 410){ // for(auto x : hp){ // for(auto [h, p] : x) if (h) cout << "#"; else cout << "."; // cout << endl; // } // } { // 右向き移動 string s = ""; int nowx = now; int nowy = 59; rep(r,24){ // 移動回数 // ここで攻撃を行う double get_power = 0; int take_turn = 100; // 敵を撃破するのにかかる時間 for(int i = nowy; i >= 0; i--){ if (hp[i][nowx].first){ //そもそも破壊可能か? if (hp[i][nowx].first <= (nowy-i)*(power/100)){ get_power = hp[i][nowx].second; take_turn = (hp[i][nowx].first) / (power/100) + (bool)((hp[i][nowx].first) % (power/100)); } break; } } beams.emplace_back(get_power / (s.size()+take_turn), s); beams.back().second.push_back('S'); // 左右移動パート while(hp[nowy][(nowx+1)%25].first || hp[nowy-1][(nowx+1)%25].first) { s.push_back('S'); nowy--; } s.push_back('R'); nowx = (nowx + 1) % 25; nowy--; } } sort(beams.rbegin(), beams.rend()); // for(auto [sc, s] : beams) { // cout << sc << " " << s << endl; // } if (beams[0].second[0] == 'S') attack(); if (beams[0].second[0] == 'L') moveL(); if (beams[0].second[0] == 'R') moveR(); deb(); } } signed main(){ if (debug) debug_input(); solve(); }