Submission #834506

#TimeUsernameProblemLanguageResultExecution timeMemory
834506JosiaThe Big Prize (IOI17_prize)C++17
Compilation error
0 ms0 KiB
#include "prize.h" using namespace std; #include <bits/stdc++.h> int numBetter = 0; set<int> candidates; map<int, vector<int>> rem; int getNumBetter(vector<int> x) { return x[0]+x[1]; } int sol = -1; vector<int> myAsk(int pos) { if (rem.count(pos)) return rem[pos]; rem[pos] = ask(pos); return rem[pos]; } void gen(int rl, int rr, int round) { if (rl == rr) {candidates.insert(rl); return;} int m = (rl + rr+round)/2; auto res = myAsk(m); auto left = myAsk(rl); auto right = myAsk(rr); if (res[0] != left[0] || getNumBetter(res)<numBetter || getNumBetter(left)<numBetter) gen(rl, m, 0); if (res[1] != right[1] || getNumBetter(res)<numBetter || getNumBetter(right)<numBetter) gen(m, rr, 1); } int find_best(int n) { candidates.clear(); sol=-1; rem.clear(); numBetter=0; for (int i = 0; i<min(n, 474); i++) { int hereBetter = getNumBetter(myAsk(i)); if (sol != -1) return sol; if (hereBetter > numBetter) { numBetter = hereBetter; } } gen(0, n-1); for (int i: candidates) { if (getNumBetter(myAsk(i)) == 0) return i; } assert(0); }

Compilation message (stderr)

prize.cpp: In function 'int find_best(int)':
prize.cpp:51:12: error: too few arguments to function 'void gen(int, int, int)'
   51 |  gen(0, n-1);
      |            ^
prize.cpp:24:6: note: declared here
   24 | void gen(int rl, int rr, int round) {
      |      ^~~