結果

問題 No.5017 Tool-assisted Shooting
ユーザー merom686merom686
提出日時 2023-07-16 18:49:42
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,650 ms / 2,000 ms
コード長 3,899 bytes
コンパイル時間 2,699 ms
コンパイル使用メモリ 203,868 KB
実行使用メモリ 24,336 KB
スコア 4,239,452
平均クエリ数 3869.51
最終ジャッジ日時 2023-07-16 18:52:24
合計ジャッジ時間 125,967 ms
ジャッジサーバーID
(参考情報)
judge15 / judge17
純コード判定しない問題か言語
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,255 ms
23,976 KB
testcase_01 AC 1,138 ms
23,376 KB
testcase_02 AC 904 ms
24,336 KB
testcase_03 AC 1,229 ms
24,264 KB
testcase_04 AC 1,081 ms
23,964 KB
testcase_05 AC 1,000 ms
24,324 KB
testcase_06 AC 1,173 ms
23,484 KB
testcase_07 AC 1,129 ms
23,376 KB
testcase_08 AC 1,060 ms
23,676 KB
testcase_09 AC 951 ms
23,364 KB
testcase_10 AC 1,177 ms
23,364 KB
testcase_11 AC 944 ms
23,604 KB
testcase_12 AC 1,214 ms
23,484 KB
testcase_13 AC 1,192 ms
24,216 KB
testcase_14 AC 1,168 ms
23,616 KB
testcase_15 AC 1,126 ms
23,652 KB
testcase_16 AC 953 ms
24,336 KB
testcase_17 AC 1,158 ms
23,628 KB
testcase_18 AC 1,303 ms
24,216 KB
testcase_19 AC 1,108 ms
24,324 KB
testcase_20 AC 1,045 ms
23,376 KB
testcase_21 AC 1,268 ms
24,288 KB
testcase_22 AC 853 ms
24,312 KB
testcase_23 AC 1,139 ms
23,376 KB
testcase_24 AC 1,292 ms
24,276 KB
testcase_25 AC 1,262 ms
24,276 KB
testcase_26 AC 1,170 ms
24,312 KB
testcase_27 AC 1,102 ms
23,532 KB
testcase_28 AC 972 ms
23,664 KB
testcase_29 AC 1,133 ms
23,496 KB
testcase_30 AC 835 ms
24,312 KB
testcase_31 AC 1,016 ms
24,264 KB
testcase_32 AC 1,332 ms
23,772 KB
testcase_33 AC 1,321 ms
23,652 KB
testcase_34 AC 1,021 ms
24,324 KB
testcase_35 AC 917 ms
23,532 KB
testcase_36 AC 1,103 ms
24,312 KB
testcase_37 AC 1,221 ms
23,352 KB
testcase_38 AC 1,144 ms
23,364 KB
testcase_39 AC 1,156 ms
23,964 KB
testcase_40 AC 1,153 ms
23,580 KB
testcase_41 AC 1,095 ms
23,520 KB
testcase_42 AC 1,208 ms
23,388 KB
testcase_43 AC 1,083 ms
23,784 KB
testcase_44 AC 1,143 ms
23,952 KB
testcase_45 AC 1,061 ms
23,988 KB
testcase_46 AC 1,279 ms
23,364 KB
testcase_47 AC 695 ms
23,640 KB
testcase_48 AC 1,340 ms
24,036 KB
testcase_49 AC 1,092 ms
23,616 KB
testcase_50 AC 1,142 ms
23,784 KB
testcase_51 AC 1,301 ms
23,376 KB
testcase_52 AC 1,155 ms
23,328 KB
testcase_53 AC 1,148 ms
23,400 KB
testcase_54 AC 1,137 ms
24,300 KB
testcase_55 AC 1,065 ms
23,772 KB
testcase_56 AC 1,199 ms
23,568 KB
testcase_57 AC 1,137 ms
23,376 KB
testcase_58 AC 1,650 ms
23,820 KB
testcase_59 AC 1,316 ms
23,544 KB
testcase_60 AC 1,327 ms
24,312 KB
testcase_61 AC 1,166 ms
23,640 KB
testcase_62 AC 1,104 ms
23,424 KB
testcase_63 AC 1,050 ms
23,604 KB
testcase_64 AC 1,009 ms
23,640 KB
testcase_65 AC 1,301 ms
24,048 KB
testcase_66 AC 1,358 ms
23,628 KB
testcase_67 AC 1,150 ms
23,820 KB
testcase_68 AC 1,175 ms
23,412 KB
testcase_69 AC 1,334 ms
23,772 KB
testcase_70 AC 1,102 ms
23,568 KB
testcase_71 AC 1,193 ms
23,604 KB
testcase_72 AC 909 ms
24,300 KB
testcase_73 AC 1,205 ms
24,060 KB
testcase_74 AC 1,116 ms
23,640 KB
testcase_75 AC 1,068 ms
23,532 KB
testcase_76 AC 1,272 ms
23,964 KB
testcase_77 AC 1,300 ms
24,300 KB
testcase_78 AC 1,280 ms
23,316 KB
testcase_79 AC 1,201 ms
23,400 KB
testcase_80 AC 1,062 ms
23,328 KB
testcase_81 AC 1,080 ms
23,664 KB
testcase_82 AC 1,171 ms
23,616 KB
testcase_83 AC 1,033 ms
23,604 KB
testcase_84 AC 1,109 ms
23,664 KB
testcase_85 AC 1,135 ms
24,300 KB
testcase_86 AC 1,244 ms
23,532 KB
testcase_87 AC 1,134 ms
23,832 KB
testcase_88 AC 1,228 ms
23,412 KB
testcase_89 AC 1,125 ms
23,676 KB
testcase_90 AC 1,186 ms
23,976 KB
testcase_91 AC 1,381 ms
23,532 KB
testcase_92 AC 1,000 ms
23,352 KB
testcase_93 AC 1,202 ms
23,412 KB
testcase_94 AC 1,090 ms
23,592 KB
testcase_95 AC 1,460 ms
23,784 KB
testcase_96 AC 1,300 ms
23,412 KB
testcase_97 AC 1,166 ms
23,364 KB
testcase_98 AC 1,268 ms
23,472 KB
testcase_99 AC 962 ms
23,988 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

array<int, 3> b[25][1100];
array<int, 3> b1[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 = 100000;
            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;
                    int p = b[i][y + j][1];
                    if (t > j) s = 200000; else s = -1000000 * pow(p, m > 200 ? 0 : 1) / t;
                    break;
                }
            }
            for (int j = 1 + d; j < 60; j++) {
                if (auto h = b[i][y + j][0]; h > 0) {
                    s--;
                }
            }
            r[i] = s;
        }
        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] = 300000;
            if (int x1 = (x - i + 25) % 25; t[1] |= b[x1][y + 1 - i][0] | o[x1]) r[x1] = 300000;
        }
        if (int i = min_element(r, r + 25) - r; i != x) c = "LR"[i - x > 0 ^ abs(i - x) > 12];

        if (m > 200) {
            int L = min(8, 1000 - turn);
            int s0 = 0;
            for (int k = 0; k < (int)pow(3, L); k++) {
                int p[10] = {}, t = k;
                for (int i = 0; i < L; i++) {
                    p[i] = t % 3 - 1; t /= 3;
                }
                int s = 0;
                int x1 = x, y1 = y, l1 = l;
                for (int i = 0; i < 25; i++) {
                    for (int j = y; j < y + 60; j++) {
                        b1[i][j] = b[i][j];
                    }
                }
                for (int i = 0; i < L; i++) {
                    x1 += p[i];
                    if (x1 < 0) x1 += 25;
                    if (x1 >= 25) x1 -= 25;
                    if (b1[x1][y1][0]) {
                        s = 0;
                        break;
                    }
                    for (int j = 1; j < 60; j++) {
                        if (auto &h = b1[x1][y1 + j][0]; h > 0) {
                            h -= l1 / 100;
                            if (h <= 0) {
                                h = 0;
                                l1 += b1[x1][y1 + j][1];
                                s += b1[x1][y1 + j][2];
                            }
                            break;
                        }
                    }
                    y1++;
                    if (b1[x1][y1][0]) {
                        s = 0;
                        break;
                    }
                }
                if (s > s0) {
                    s0 = s;
                    c = "LSR"[p[0] + 1];
                }
            }
        }

        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