結果

問題 No.5017 Tool-assisted Shooting
ユーザー nocturnal_1202nocturnal_1202
提出日時 2023-07-16 15:14:14
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 31 ms / 2,000 ms
コード長 3,547 bytes
コンパイル時間 3,438 ms
コンパイル使用メモリ 188,428 KB
実行使用メモリ 24,492 KB
スコア 391
平均クエリ数 70.85
最終ジャッジ日時 2023-07-16 15:14:25
合計ジャッジ時間 10,742 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
純コード判定しない問題か言語
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <algorithm>
#include <bitset>
#include <complex>
#include <cassert>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <math.h>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include<regex>
#include<atcoder/all>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#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<int, int> pii;
ll mod998 = 998244353;
ll mod109 = 1e9 + 7;
//vector<vector<int>> a(n,vector<int>(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<vector<pii>> power(h, vector<pii>(w));
//aim...各列で一番下方にあるやつ
vector<pair<int,pii>> 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;
        sum_reload();
    }

    
}

0