Submission #316093

#TimeUsernameProblemLanguageResultExecution timeMemory
316093MrDominoThe Big Prize (IOI17_prize)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "prize.h" using namespace std; mt19937 rng((long long) (new char)); int rn(int l, int r) { return l + rng() % (r - l + 1); } int rep(int l, int r, int q) { assert(q >= 0); if (l > r || q == 0) { return 0; } int i = rn(l, r); vector<int> v = ask(i); q--; if (v[0] == 0 && v[1] == 0) { return i; } if (v[0] == 0) { return rep(i + 1, r, q); } if (v[1] == 0) { return rep(l, i - 1, q); } /// cnt(0) / cnt(1) = v[0] / v[1] /// cnt(0) + cnt(1) = q ll c0 = (ll) v[0] * q / (v[0] + v[1]); ll c1 = q - c0; int x = rep(l, i - 1, (int) c0); if (x) { return x; } else { return rep(i + 1, r, (int) c1); } } int find_best(int n) { return rep(0, n - 1, 9000); }

Compilation message (stderr)

prize.cpp: In function 'int rep(int, int, int)':
prize.cpp:31:3: error: 'll' was not declared in this scope; did you mean 'l'?
   31 |   ll c0 = (ll) v[0] * q / (v[0] + v[1]);
      |   ^~
      |   l
prize.cpp:32:5: error: expected ';' before 'c1'
   32 |   ll c1 = q - c0;
      |     ^~~
      |     ;
prize.cpp:33:31: error: 'c0' was not declared in this scope; did you mean 'y0'?
   33 |   int x = rep(l, i - 1, (int) c0);
      |                               ^~
      |                               y0
prize.cpp:37:32: error: 'c1' was not declared in this scope; did you mean 'y1'?
   37 |     return rep(i + 1, r, (int) c1);
      |                                ^~
      |                                y1