Submission #1203867

#TimeUsernameProblemLanguageResultExecution timeMemory
1203867nikolashamiThe Big Prize (IOI17_prize)C++20
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; using ll=long long; #include"prize.h" const ll L=500; int find_best(int n){ map<ll,ll>C; for(int i=0;i<L;++i){ vector<int>a=ask(i); ++C[a[0]+a[1]]; if(!a[0]&&!a[1])return i; } ll x=0,lik=L-1,br,l,r; for(auto[u,v]:C)x=max(x,u); br=L-C[x]; while(1){ l=lik+1,r=n-1; while(l<=r){ ll m=(l+r)/2; vector<int>a=ask(m); if(!a[0]&&!a[1])return i; else if(a[0]+a[1]==x){ if(a[0]!=br)r=m-1; else l=m+1; }else{ x=m; r=m-1; } } ++br; } return -1; }

Compilation message (stderr)

prize.cpp: In function 'int find_best(int)':
prize.cpp:23:48: error: 'i' was not declared in this scope
   23 |                         if(!a[0]&&!a[1])return i;
      |                                                ^