結果

問題 No.5018 Let's Make a Best-seller Book
ユーザー merom686
提出日時 2023-10-01 14:30:15
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 33 ms / 400 ms
コード長 3,238 bytes
コンパイル時間 2,877 ms
コンパイル使用メモリ 244,424 KB
実行使用メモリ 24,396 KB
スコア 33,786
平均クエリ数 52.00
最終ジャッジ日時 2023-10-01 14:30:26
合計ジャッジ時間 10,738 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
純コード判定しない問題か言語
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 100
権限があれば一括ダウンロードができます

ソースコード

diff #

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

double rnd() {
    static mt19937 e(1);
    static double t = pow(0.5, 32.0);
    return e() * t;
}

int main() {
#define TEST 0
#if TEST == 0
    int t, n, m;
    cin >> t >> n >> m;
    {
        int s[10] = {}, p[10] = {}, r[10] = {};
        while (t--) {
#else
    int tn = 1, s0 = 1 << 30, s1 = -1, ss = 0;
    for (int tt = 0; tt < tn; tt++) {
        int t = 52, n = 10, m = 2000000;
        int p[10] = {}, r[10] = {};
        int sc = 0;

        double d[10];
        for (int i = 0; i < n; i++) {
            d[i] = 0.5 + rnd();
        }

        while (t--) {
#endif
            int l[10] = {};
            int x = 0;
            for (int i = 0; i < n; i++) {
                if (t < 15) {
                    l[i] = m / (500 * n);
                } else {
                    l[i] = min(m / (500 * n), max(10 - r[i], 0));
                }
            }
            if (t >= 52 - 1) x = 2;
#if TEST == 0
            if (x == 0) {
                cout << 1;
                for (int i = 0; i < n; i++) {
                    cout << ' ' << l[i];
                }
                cout << endl;
            } else {
                cout << 2 << ' ' << x << endl;
            }
            cin >> m;
            if (m < 0) exit(0);
            for (int i = 0; i < n; i++) {
                cin >> s[i];
            }
            for (int i = 0; i < n; i++) {
                cin >> p[i];
            }
            for (int i = 0; i < n; i++) {
                cin >> r[i];
            }
        }
    }
#else
            if (x == 0) {
                for (int i = 0; i < n; i++) {
                    r[i] += l[i];
                    m -= l[i] * 500;
                    if (m < 0) throw;
                }
            } else {
                m -= 250000 << x;
                if (m < 0) throw;
                for (int i = 0; i < n; i++) {
                    p[i] += x;
                    p[i] = min(p[i], 60);
                }
            }

            int s[10] = {};
            for (int i = 0; i < n; i++) {
                s[i] = min(r[i], (int)floor(sqrt(r[i]) * pow(1.05, p[i]) * d[i] * (0.75 + 0.5 * rnd())));
                m += s[i] * 1000;
                sc += s[i];
            }
            for (int i = 0; i < n; i++) {
                if (r[i] > 0) {
                    int u = 10 * s[i] / r[i];
                    p[i] += u >= 3;
                    p[i] -= u < 1;
                    p[i] = clamp(p[i], -60, 60);
                }
            }
            for (int i = 0; i < n; i++) {
                r[i] -= s[i];
            }
            if (tn == 1) {
                cout << m << '\n';
                for (int i = 0; i < n; i++) {
                    cout << s[i] << " \n"[i == n - 1];
                }
                for (int i = 0; i < n; i++) {
                    cout << p[i] << " \n"[i == n - 1];
                }
                for (int i = 0; i < n; i++) {
                    cout << r[i] << " \n"[i == n - 1];
                }
            }
        }

        s0 = min(s0, sc);
        s1 = max(s1, sc);
        ss += sc;
    }
    cout << s0 << ' ' << ss / tn << ' ' << s1 << endl;
#endif

    return 0;
}
0