#include // clang-format off using namespace std; using ll=long long; using ull=unsigned long long; using pll=pair; const ll INF=4e18; void print0(){}; template void print0(H h,T... t){cout<void print(H h,T... t){print0(h);if(sizeof...(T)>0)print0(" ");print(t...);} void perr0(){}; template void perr0(H h,T... t){cerr<void perr(H h,T... t){perr0(h);if(sizeof...(T)>0)perr0(" ");perr(t...);} void ioinit() { cout< zaiko; vector ninki; int money; }; struct operation_t { int kind; int x; vector send; }; struct response_t { int money; vector sell; vector ninki; vector zaiko; }; operation_t selectop(int turn, state_t& state, vector>& history) { if (turn == 1) { vector send(N, 5); return operation_t{1, 0, send}; } if(turn < 45 && turn % 2 == 0) { if (state.money >= 8000000 * 2) { return operation_t{2, 5, vector()}; } if (state.money >= 4000000 * 2) { return operation_t{2, 4, vector()}; } if (state.money >= 2000000 * 2) { return operation_t{2, 3, vector()}; } if (state.money >= 1000000 * 2) { return operation_t{2, 2, vector()}; } if (state.money >= 500000 * 2) { return operation_t{2, 1, vector()}; } } // 0.7Riだけ売る、最低3冊置いとく // 前週の売上を見る vector 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.5r int 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.5 <= lastsell) { result = snd; left = snd + 1; } else { right = snd - 1; } } result = max(3 - state.zaiko[shop], result); send[shop] = result; } int ttl=0; for(int s=0;s state.money){ double dec = 1.0* state.money / ttl; for(int s=0;s> 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> 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; }