Submission #282908

#TimeUsernameProblemLanguageResultExecution timeMemory
282908turbatThe Big Prize (IOI17_prize)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #include "prize.h" using namespace std; int find_best(int n) { int l, r, mx = -1e9, mid; for (int i = 0;i < min(10, n);i++){ int ind = rand() % n; vector<int> res = ask(ind); if(res[0] + res[1] == 0) return i; mx = mx(mx, ask([i])) } for(int i = 0; i < n; i++){ vector<int> res = ask(i); if(res[0] + res[1] == 0) return i; mx = max(mx , res[0]+res[1]); if((res[0]+res[1]) < mx) continue; l = i + 1; r = n - 1; while(l <= r){ ll mid = (l+r)/2; vector<int> tmp=ask(mid); if(tmp[0]+tmp[1]==0)return mid; if(tmp == res){ i = mid; l = mid+1; } else r = mid-1; } } }

Compilation message (stderr)

prize.cpp: In lambda function:
prize.cpp:11:26: error: expected '{' before ')' token
   11 |       mx = mx(mx, ask([i]))
      |                          ^
prize.cpp: In function 'int find_best(int)':
prize.cpp:11:26: error: cannot convert 'find_best(int)::<lambda()>' to 'int'
In file included from prize.cpp:2:
prize.h:4:26: note:   initializing argument 1 of 'std::vector<int> ask(int)'
    4 | std::vector<int> ask(int i);
      |                      ~~~~^
prize.cpp:11:27: error: 'mx' cannot be used as a function
   11 |       mx = mx(mx, ask([i]))
      |                           ^
prize.cpp:22:13: error: 'll' was not declared in this scope; did you mean 'l'?
   22 |             ll mid = (l+r)/2;
      |             ^~
      |             l
prize.cpp:32:1: warning: control reaches end of non-void function [-Wreturn-type]
   32 | }
      | ^