Submission #317370

#TimeUsernameProblemLanguageResultExecution timeMemory
317370tigichaThe Big Prize (IOI17_prize)C++14
Compilation error
0 ms0 KiB
#include "prize.h" #include<bits/stdc++.h> using namespace std; vector <int> v; int mx, k, p, l, r, m, ans; int find_best(int n){ for(int i=0; i<474;i++){ v=ask(i); if(v[0]+v[1]==0) return i; if(v[0]+v[1]>mx){ mx=v[0]+v[1]; k=i; p=v[0]; } } while(true){ l=k+1; r=n-1; while(l<=r){ m=(l+r)/2; v=ask(m); if(v[0]+v[1]==0) return m; if(v[0]+v[1]==mx && v[0]==p) l=m+1; else r=m-1; if(v[0]+v[1]!=mx) ans=m; } for(int i=ans; i<n; i++){ a=ask(i); if(v[0]+v[1]==0) return i; if(v[0]+v[1]==mx){ k=i; p=a.first; break; } } } }

Compilation message (stderr)

prize.cpp: In function 'int find_best(int)':
prize.cpp:28:4: error: 'a' was not declared in this scope
   28 |    a=ask(i);
      |    ^