結果
問題 | No.5018 Let's Make a Best-seller Book |
ユーザー |
|
提出日時 | 2023-10-01 18:11:15 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 4,094 bytes |
コンパイル時間 | 2,377 ms |
コンパイル使用メモリ | 212,680 KB |
実行使用メモリ | 24,516 KB |
スコア | 1,989 |
平均クエリ数 | 52.00 |
最終ジャッジ日時 | 2023-10-01 18:11:27 |
合計ジャッジ時間 | 10,712 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 8 WA * 92 |
ソースコード
#include <bits/stdc++.h>// clang-format offusing namespace std; using ll=long long; using ull=unsigned long long; using pll=pair<ll,ll>; const ll INF=4e18;void print0(){}; template<typename H,typename... T> void print0(H h,T... t){cout<<h;print0(t...);}void print(){print0("\n");}; template<typename H,typename... T>void print(H h,T... t){print0(h);if(sizeof...(T)>0)print0(" ");print(t...);}void perr0(){}; template<typename H,typename... T> void perr0(H h,T... t){cerr<<h;perr0(t...);}void perr(){perr0("\n");}; template<typename H,typename... T>void perr(H h,T... t){perr0(h);if(sizeof...(T)>0)perr0(" ");perr(t...);}void ioinit() { cout<<fixed<<setprecision(15); cerr<<fixed<<setprecision(6); ios_base::sync_with_stdio(0); cin.tie(0); }#define debug1(a) { cerr<<#a<<":"<<a<<endl; }#define debug2(a,b) { cerr<<#a<<":"<<a<<" "<<#b<<":"<<b<<endl; }#define debug3(a,b,c) { cerr<<#a<<":"<<a<<" "<<#b<<":"<<b<<" "<<#c<<":"<<c<<endl; }#define debug4(a,b,c,d) { cerr<<#a<<":"<<a<<" "<<#b<<":"<<b<<" "<<#c<<":"<<c<<" "<<#d<<":"<<d<<endl; }// clang-format onconst int T = 52;const int N = 10;struct state_t {vector<int> zaiko;vector<int> ninki;int money;};struct operation_t {int kind;int x;vector<int> send;};struct response_t {int money;vector<int> sell;vector<int> ninki;vector<int> zaiko;};operation_t selectop(int turn, state_t& state, vector<pair<operation_t, response_t>>& history) {if (turn == 1) {vector<int> send(N, 3);return operation_t{1, 0, send};}if(turn < 45 && turn % 2 == 0) {if (state.money >= 8500000) {return operation_t{2, 5, vector<int>()};}if (state.money >= 4500000) {return operation_t{2, 4, vector<int>()};}if (state.money >= 2500000) {return operation_t{2, 3, vector<int>()};}if (state.money >= 1500000) {return operation_t{2, 2, vector<int>()};}if (state.money >= 700000) {return operation_t{2, 1, vector<int>()};}}// 0.7Riだけ売る、最低3冊置いとく// 前週の売上を見るvector<int> send(N);for (int shop = 0; shop < N; shop++) {int lastsell = history[turn - 1].second.sell[shop];if (turn >= 2) lastsell = max(history[turn - 1].second.sell[shop], history[turn - 2].second.sell[shop]);// r=(state.zaiko[shop] + snd);// lastsell >= 0.5rint left = 0;int right = 9999999;int result = 0;while (left <= right) {int snd = (left + right) / 2;int r = (state.zaiko[shop] + snd);if (r * 0.7 <= lastsell) {result = snd;left = snd + 1;} else {right = snd - 1;}}result = max(3 - state.zaiko[shop], result);send[shop] = result;}return operation_t{1, 0, send};}response_t output(operation_t& op) {if (op.kind == 1) {cout << "1";for (int l : op.send) {cout << " " << l;}cout << endl;} else {cout << "2 " << op.x << endl;}response_t res;cin >> res.money;res.sell.resize(N);res.ninki.resize(N);res.zaiko.resize(N);for (int shop = 0; shop < N; shop++) {cin >> res.sell[shop];}for (int shop = 0; shop < N; shop++) {cin >> res.ninki[shop];}for (int shop = 0; shop < N; shop++) {cin >> res.zaiko[shop];}return res;}void solve(state_t state) {vector<pair<operation_t, response_t>> history;for (int turn = 0; turn < T; turn++) {auto op = selectop(turn, state, history);auto resp = output(op);history.push_back({op, resp});state.money = resp.money;state.zaiko = resp.zaiko;}}int main() {ioinit();int _t, _n, _m;cin >> _t >> _n >> _m;state_t state;state.zaiko.resize(N, 0);state.ninki.resize(N, 0);state.money = _m;solve(state);return 0;}