結果

問題 No.5018 Let's Make a Best-seller Book
ユーザー merom686merom686
提出日時 2023-10-01 15:59:23
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 33 ms / 400 ms
コード長 4,620 bytes
コンパイル時間 2,825 ms
コンパイル使用メモリ 245,144 KB
実行使用メモリ 24,504 KB
スコア 93,356
平均クエリ数 52.00
最終ジャッジ日時 2023-10-01 15:59:41
合計ジャッジ時間 10,800 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
純コード判定しない問題か言語
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

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

#define TEST 0

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

int main() {
#if TEST == 0
    int t, n, m;
    cin >> t >> n >> m;
    {
        int s[10] = {}, p[10] = {}, r[10] = {};
        double s3[10] = {}, r3[10] = {};
        int s4[10] = {};
        while (t--) {
#else
    int tn = 1000, 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] = {};
        double s3[10] = {}, r3[10] = {};
        int s4[10] = {};
        int sc = 0;

        double d[10];
        for (int i = 0; i < n; i++) {
            d[i] = 0.5 + rnd();
            if (tn == 1) {
                cout << d[i] << " \n"[i == n - 1];
            }
        }

        while (t--) {
#endif
            int l[10] = {};
            int x = 0;
            if (t < 10) {
                double k = 0;
                for (int i = 0; i < n; i++) {
                    double d1 = s3[i] / r3[i];
                    k += pow(d1 * pow(1.05, p[i]), 2);
                }
                for (int i = 0; i < n; i++) {
                    double d1 = s3[i] / r3[i];
                    int x = m * pow(d1 * pow(1.05, p[i]), 2) / k / 500;
                    //x = max(x, 5);
                    //l[i] = max(x - r[i], 0);
                    l[i] = x;
                }
            } else {
                for (int i = 0; i < n; i++) {
                    int x = 9;
                    if (r3[i] > 0) {
                        double d1 = s3[i] / r3[i];
                        x = (int)round(pow(pow(1.05, p[i]) * d1 / 0.5, 2));
                        //x = (x + 10) / 2;
                        x = max(x, 5);
                    }
                    //cout << x << " \n"[i == n - 1];
                    l[i] = min(m / (500 * n), max(x - r[i], 0));
                }
                //if (t >= 52 - 1) x = 2;
                if (m >= 1750000) 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];
            }
            int p2[10];
            for (int i = 0; i < n; i++) {
                p2[i] = p[i];
                cin >> p[i];
            }
            for (int i = 0; i < n; i++) {
                cin >> r[i];
                s4[i] += s[i];
                s3[i] += (s[i] + 0.0) * pow(1.05, -p2[i]);
                r3[i] += sqrt(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];
                s4[i] += s[i];
                s3[i] += (s[i] + 0.0) * pow(1.05, -p[i]);
                r3[i] += sqrt(r[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