#include using namespace std; using ll = long long; double rnd() { static mt19937 e(1); static double t = pow(0.5, 32.0); return e() * t; } int main() { #define TEST 0 #if TEST == 0 int t, n, m; cin >> t >> n >> m; { int s[10] = {}, p[10] = {}, r[10] = {}; while (t--) { #else int tn = 1, 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] = {}; int sc = 0; double d[10]; for (int i = 0; i < n; i++) { d[i] = 0.5 + rnd(); } while (t--) { #endif int l[10] = {}; int x = 0; for (int i = 0; i < n; i++) { if (t < 15) { l[i] = m / (500 * n); } else { l[i] = min(m / (500 * n), max(10 - r[i], 0)); } } if (t >= 52 - 1) 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]; } for (int i = 0; i < n; i++) { cin >> p[i]; } for (int i = 0; i < n; i++) { cin >> 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]; } 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; }