#define _USE_MATH_DEFINES //#define NDEBUG #pragma GCC target("avx2") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include #include #include #include #include #include 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(system_clock::now() - starttime).count() * 2.0; #else return duration_cast(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 <<" "<= 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); }