結果

問題 No.5017 Tool-assisted Shooting
ユーザー merom686
提出日時 2023-07-16 17:31:23
言語 C++17(gcc12)
(gcc 12.3.0 + boost 1.87.0)
結果
AC  
実行時間 109 ms / 2,000 ms
コード長 2,348 bytes
コンパイル時間 3,209 ms
コンパイル使用メモリ 202,440 KB
実行使用メモリ 24,408 KB
スコア 3,939,778
平均クエリ数 3891.80
最終ジャッジ日時 2023-07-16 17:31:42
合計ジャッジ時間 15,552 ms
ジャッジサーバーID
(参考情報)
judge16 / judge14
純コード判定しない問題か言語
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 100
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using ll = long long;
using namespace std;

array<int, 3> b[25][1100];

int main() {
    int x = 12, y = 0, l = 100;
    for (int turn = 0; turn < 1000; turn++) {
        int n;
        cin >> n;

        if (n < 0) exit(0);

        for (int i = 0; i < n; i++) {
            int h, p, x;
            cin >> h >> p >> x;

            b[x][y + 60] = { h, p, h };
        }
        y++;

        int m = l / 100;

        char c = 'S';
        int r[25], o[25] = {};
        for (int i = 0; i < 25; i++) {
            int s = 1;
            int d = abs(x - i);
            d = min(d, 25 - d);
            d = max(d - 1, 0);
            if (auto h = b[i][y + 1 + d][0]; h > m) o[i] = 1;
            for (int j = 1 + d; j < 60; j++) {
                if (auto h = b[i][y + j][0]; h > 0) {
                    int t = (h + m - 1) / m + d;
                    if (t > j) s = 2; else s = -100000 * b[i][y + j][1 + (m > 200 || turn > 980)] / t;
                    break;
                }
            }
            r[i] = s;
        }
        if (m > 200) {
            if (int i = min_element(r, r + 25) - r; i != x) c = "LR"[i - x > 0 ^ abs(i - x) > 12];
        }
        int t[2] = {};
        for (int i = 1; i <= 12; i++) {
            if (int x0 = (x + i + 25) % 25; t[0] |= b[x0][y - 1 + i][0] | o[x0]) r[x0] = 3;
            if (int x1 = (x - i + 25) % 25; t[1] |= b[x1][y + 1 - i][0] | o[x1]) r[x1] = 3;
        }
        if (m > 200) {
            if (int i = min_element(r, r + 25) - r; c != "LR"[i - x > 0 ^ abs(i - x) > 12] && r[x] <= 1) c = 'S';
        } else {
            if (int i = min_element(r, r + 25) - r; i != x) c = "LR"[i - x > 0 ^ abs(i - x) > 12];
        }
        cout << "#" << x << ' ' << y << ' ' << min_element(r, r + 25) - r << '\n';
        cout << '#';
        for (int i = 0; i < 25; i++) {
            cout << r[i] << " \n"[i == 24];
        }
        cout << c << endl;

        x += (c == 'R') - (c == 'L');
        x = (x + 25) % 25;
        for (int j = 1; j < 60; j++) {
            if (auto &h = b[x][y + j][0]; h > 0) {
                h -= m;
                if (h <= 0) {
                    h = 0;
                    l += b[x][y + j][1];
                }
                cout << "#" << l << ' ' << h << '\n';
                break;
            }
        }
    }

    return 0;
}
0