Submission #40217

#TimeUsernameProblemLanguageResultExecution timeMemory
40217jackyliuxxThe Big Prize (IOI17_prize)C++14
Compilation error
0 ms0 KiB
#include "prize.h" #include <iostream> using namespace std; int gogo(int fr, int to, int lc, int rc, int mxc) { if (lc + rc == mxc) { return -1; } int mid = (fr + to) / 2; int lto = mid, rfr = mid + 1; vector<int> res; int n = to - fr; for (int i = 0; i < n; i++) { if (i & 1) { mid -= i; } else { mid += i; } lto = min(lto, mid); rfr = max(rfr, mid + 1); res = ask(mid); int c = res[0] + res[1]; if (c == 0) { return mid; } else if (c == mxc) { int lrc, rlc; if (mid == lto) { lrc = res[1]; rlc = res[0] + i; } else { lrc = res[1] + i; rlc = res[0]; } int lrt = gogo(fr, lto, lc, lrc, mxc); if (lrt != -1) { return lrt; } else { return gogo(rfr, to, rlc, rc, mxc)); } } } return -1; } int find_best(int n) { int mxc = 0; for(int i = 0; i < n && i < 500; i++) { std::vector<int> res = ask(i); if(res[0] + res[1] == 0) return i; if (res[0] + res[1] > mxc) { mxc = res[0] + res[1]; } } return gogo(0, n, 0, 0, mxc); }

Compilation message (stderr)

prize.cpp: In function 'int gogo(int, int, int, int, int)':
prize.cpp:39:49: error: expected ';' before ')' token
               return gogo(rfr, to, rlc, rc, mxc));
                                                 ^
prize.cpp:39:49: error: expected primary-expression before ')' token