結果
問題 | No.5018 Let's Make a Best-seller Book |
ユーザー | Pechi |
提出日時 | 2023-10-01 16:06:05 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 45 ms / 400 ms |
コード長 | 4,561 bytes |
コンパイル時間 | 5,179 ms |
コンパイル使用メモリ | 219,672 KB |
実行使用メモリ | 24,420 KB |
スコア | 74,084 |
平均クエリ数 | 52.00 |
最終ジャッジ日時 | 2023-10-01 16:06:19 |
合計ジャッジ時間 | 11,854 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge14 |
純コード判定しない問題か言語 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 45 ms
23,520 KB |
testcase_01 | AC | 28 ms
23,520 KB |
testcase_02 | AC | 28 ms
24,240 KB |
testcase_03 | AC | 27 ms
23,664 KB |
testcase_04 | AC | 27 ms
24,048 KB |
testcase_05 | AC | 28 ms
23,400 KB |
testcase_06 | AC | 29 ms
23,676 KB |
testcase_07 | AC | 28 ms
23,664 KB |
testcase_08 | AC | 27 ms
23,388 KB |
testcase_09 | AC | 29 ms
24,372 KB |
testcase_10 | AC | 29 ms
23,376 KB |
testcase_11 | AC | 28 ms
23,364 KB |
testcase_12 | AC | 27 ms
24,048 KB |
testcase_13 | AC | 28 ms
24,036 KB |
testcase_14 | AC | 28 ms
23,532 KB |
testcase_15 | AC | 28 ms
23,412 KB |
testcase_16 | AC | 29 ms
24,360 KB |
testcase_17 | AC | 28 ms
23,412 KB |
testcase_18 | AC | 27 ms
23,664 KB |
testcase_19 | AC | 28 ms
24,252 KB |
testcase_20 | AC | 27 ms
23,376 KB |
testcase_21 | AC | 28 ms
23,664 KB |
testcase_22 | AC | 27 ms
23,364 KB |
testcase_23 | AC | 28 ms
24,036 KB |
testcase_24 | AC | 28 ms
23,664 KB |
testcase_25 | AC | 27 ms
23,832 KB |
testcase_26 | AC | 28 ms
24,048 KB |
testcase_27 | AC | 28 ms
24,024 KB |
testcase_28 | AC | 28 ms
23,544 KB |
testcase_29 | AC | 28 ms
24,036 KB |
testcase_30 | AC | 27 ms
23,604 KB |
testcase_31 | AC | 27 ms
24,420 KB |
testcase_32 | AC | 27 ms
23,832 KB |
testcase_33 | AC | 28 ms
24,012 KB |
testcase_34 | AC | 28 ms
24,036 KB |
testcase_35 | AC | 28 ms
23,664 KB |
testcase_36 | AC | 28 ms
23,652 KB |
testcase_37 | AC | 28 ms
23,376 KB |
testcase_38 | AC | 28 ms
23,664 KB |
testcase_39 | AC | 27 ms
23,424 KB |
testcase_40 | AC | 28 ms
23,520 KB |
testcase_41 | AC | 27 ms
23,664 KB |
testcase_42 | AC | 27 ms
23,664 KB |
testcase_43 | AC | 28 ms
24,024 KB |
testcase_44 | AC | 28 ms
23,640 KB |
testcase_45 | AC | 28 ms
24,276 KB |
testcase_46 | AC | 27 ms
24,036 KB |
testcase_47 | AC | 28 ms
24,048 KB |
testcase_48 | AC | 28 ms
23,628 KB |
testcase_49 | AC | 28 ms
24,048 KB |
testcase_50 | AC | 27 ms
23,640 KB |
testcase_51 | AC | 28 ms
23,532 KB |
testcase_52 | AC | 27 ms
23,424 KB |
testcase_53 | AC | 28 ms
24,276 KB |
testcase_54 | AC | 27 ms
23,640 KB |
testcase_55 | AC | 28 ms
23,652 KB |
testcase_56 | AC | 27 ms
23,388 KB |
testcase_57 | AC | 27 ms
23,676 KB |
testcase_58 | AC | 28 ms
24,024 KB |
testcase_59 | AC | 28 ms
23,652 KB |
testcase_60 | AC | 28 ms
24,300 KB |
testcase_61 | AC | 28 ms
24,372 KB |
testcase_62 | AC | 28 ms
23,676 KB |
testcase_63 | AC | 28 ms
23,376 KB |
testcase_64 | AC | 28 ms
23,664 KB |
testcase_65 | AC | 28 ms
24,252 KB |
testcase_66 | AC | 27 ms
23,640 KB |
testcase_67 | AC | 29 ms
24,048 KB |
testcase_68 | AC | 27 ms
23,424 KB |
testcase_69 | AC | 28 ms
23,664 KB |
testcase_70 | AC | 28 ms
24,396 KB |
testcase_71 | AC | 28 ms
23,640 KB |
testcase_72 | AC | 27 ms
23,424 KB |
testcase_73 | AC | 28 ms
24,408 KB |
testcase_74 | AC | 28 ms
23,832 KB |
testcase_75 | AC | 28 ms
23,640 KB |
testcase_76 | AC | 28 ms
24,348 KB |
testcase_77 | AC | 27 ms
24,048 KB |
testcase_78 | AC | 27 ms
23,532 KB |
testcase_79 | AC | 28 ms
24,024 KB |
testcase_80 | AC | 28 ms
23,412 KB |
testcase_81 | AC | 28 ms
23,664 KB |
testcase_82 | AC | 28 ms
23,532 KB |
testcase_83 | AC | 28 ms
23,832 KB |
testcase_84 | AC | 28 ms
23,664 KB |
testcase_85 | AC | 28 ms
23,628 KB |
testcase_86 | AC | 27 ms
23,820 KB |
testcase_87 | AC | 28 ms
23,376 KB |
testcase_88 | AC | 28 ms
24,048 KB |
testcase_89 | AC | 28 ms
24,408 KB |
testcase_90 | AC | 28 ms
23,376 KB |
testcase_91 | AC | 27 ms
23,412 KB |
testcase_92 | AC | 27 ms
24,384 KB |
testcase_93 | AC | 28 ms
23,652 KB |
testcase_94 | AC | 28 ms
24,048 KB |
testcase_95 | AC | 28 ms
23,388 KB |
testcase_96 | AC | 27 ms
23,376 KB |
testcase_97 | AC | 27 ms
23,628 KB |
testcase_98 | AC | 28 ms
23,640 KB |
testcase_99 | AC | 28 ms
23,652 KB |
ソースコード
#define _USE_MATH_DEFINES //#define NDEBUG #pragma GCC target("avx2") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include<bits/stdc++.h> #include<array> #include<unordered_map> #include<unordered_set> #include<random> #include<chrono> using namespace std; typedef long long int ll; typedef unsigned long long int ull; //#define SUBMIT #ifdef SUBMIT #define NO_DEBUG #endif // SUBMIT #define MAX(A,B) max(A,B) #define MIN(A,B) min(A,B) #define IN(X) for (int in = 0; in < X.size(); in++)cin >> X[in] #define OUT(X) for (int in = 0; in < X.size(); in++)cout << X[in]<<(in==X.size()-1?"\n":" ") #define SORT(X) sort(X.begin(), X.end()) #define ALL(X,Y) for (auto X = (Y).begin(); X != (Y).end(); ++X) #define FULL(a) (a).begin(),(a).end() #define BFS(Q,S) for(Q.push(S);Q.size()!=0;Q.pop()) int dx[] = { 1,0,-1,0,0,0 }; int dy[] = { 0,1,0,-1,0,0 }; int dz[] = { 0,0,0,0,1,-1 }; int t, n, m; chrono::system_clock::time_point starttime; using namespace std::chrono; #ifndef ONLINE_JUDGE #define DEBUG #endif inline float getTime() { #ifdef DEBUG return duration_cast<milliseconds>(system_clock::now() - starttime).count() * 2.0; #else return duration_cast<milliseconds>(system_clock::now() - starttime).count(); #endif } inline long long int xor128() { static long long int x = 123456789, y = 362436069, z = 521288629, w = 88675123; long long int t = (x ^ (x << 11)); x = y; y = z; z = w; return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8))); } int p[10] = { 0 }, r[10] = { 0 }, l[10] = { 0 }, add = 0; double d[10], s[10], pl[10]; void make_plan(int now) { double sum = 0; static int mode = 0; if (mode == 0 && add >= 500000)mode = 1; if (mode != 0 && add < 500000)mode = 0; if (mode!=0) { if (mode == 1) { int cnt = m / 500; for (int i = 0; i < n; ++i) sum += (d[i] / max(1, now))*pow(1.05, p[i]); for (int i = 0; i < n; ++i)l[i] = cnt * (d[i] / max(1, now))*pow(1.05, p[i]) / sum; cout << "1 "; for (int i = 0; i < n; ++i) { cout << l[i] << " "; r[i] += l[i]; m -= l[i] * 500; } cout << endl; mode = 2; } else { int x = 1; while (500000 * pow(2, x - 1) <= m)++x; --x; if (x > 5)x = 5; cout << "2 " << x << endl; m -= 500000 * pow(2, x - 1); for (int i = 0; i < n; ++i)p[i] += x; mode = 1; } } else { int maxCnt = m / 500, cnt = 0; double border = 0.3; for (int i = 0; i < n; ++i) { pl[i] = (pow(d[i] / max(1, now), 2)*pow(7.0 / 20, 2 * p[i])*pow(3, 2 * p[i] + 2) - 16 * r[i] * pow(border, 2)) / (16.0*pow(border, 2)); if (pl[i] < 0)pl[i] = 0; cnt += pl[i]; } if (cnt == 0 && m >= 500000) { int x = 1; while (500000 * pow(2, x-1) <= m)++x; --x; if (x > 5)x = 5; cout << "2 " << x << endl; m -= 500000 * pow(2, x-1); for (int i = 0; i < n; ++i)p[i] += x; } else { cout << "1 "; for (int i = 0; i < n; ++i)l[i] = pl[i]; while (cnt > maxCnt) { int id = xor128() % n; if (l[id] != 0)--l[id], --cnt; } for (int i = 0; i < n; ++i) { cout << l[i] << " "; r[i] += l[i]; m -= l[i] * 500; } cout << endl; } } } inline void solve() { cin >> t >> n >> m; for (int i = 0; i < n; ++i)d[i] =0.75; for (int now = 0; now < t; ++now) { make_plan(now); cin >> add; add = add - m; m += add; for (int i = 0; i < n; ++i) { cin >> s[i]; s[i] /= sqrt(r[i])*pow(1.05, p[i]); if (now == 0)d[i] = 0; d[i] += s[i]; } for (int i = 0; i < n; ++i)cin >> p[i]; for (int i = 0; i < n; ++i)cin >> r[i]; } } inline void test() { int score = 0; cin >> t >> n; m = 2000000; double D[10], z[10]; for (int i = 0; i < n; ++i)d[i] = 0.75; for (int i = 0; i < n; ++i)cin >> D[i]; for (int now = 0; now < t; ++now) { make_plan(now); add = 0; cout << m << "\n=>"; for (int i = 0; i < n; ++i) { cin >> z[i]; s[i] = min((double)r[i], sqrt(r[i])*pow(1.05, p[i])*D[i] * z[i]); m += (int)s[i] * 1000; add += (int)s[i] * 1000; score += (int)s[i]; cout << (int)s[i] << " "; } cout << "\n:" << m <<" "<<add<< "\np:"; for (int i = 0; i < n; ++i) { if (s[i] != 0) { if (s[i] < 0.1*r[i])--p[i]; if (s[i] >= 0.3*r[i])++p[i]; if (p[i] < -60)p[i] = -60; if (p[i] > 60)p[i] = 60; s[i] /= sqrt(r[i])*pow(1.05, p[i]); } if (now == 0)d[i] = 0; d[i] += s[i]; cout << p[i] << " "; } cout << "\n"; for (int i = 0; i < n; ++i)r[i] -= s[i]; } cout << score / 100; } int main(int argc, char* argv[]) { starttime = chrono::system_clock::now(); ios::sync_with_stdio(false); std::cin.tie(nullptr); solve(); exit(0); }