Submission #617770

#TimeUsernameProblemLanguageResultExecution timeMemory
617770AbdelmagedNourThe Big Prize (IOI17_prize)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; #include"grader.cpp" #include "prize.h" int MAX,res=-1; bool is_max(vector<int>x){ return x[0]+x[1]==MAX; } void divide(int l,int r){ if(l>r||res!=-1)return; if(l==r){ vector<int>x=ask(l); if(x[0]+x[1]==0)res=l; return; } vector<int>x=ask(l); if(!is_max(x)){ if(x[0]+x[1]==0)res=l; divide(l+1,r); return; } vector<int>y=ask(r); if(!is_max(y)){ if(y[0]+y[1]==0){ res=r; return; } for(int k=__lg(r-l+1);k>=0;k--){ if(l+(1<<k)<r&&ask(l+(1<<k))==x)l+=(1<<k); } divide(l+1,r-1); return; } if(x[0]==y[0]&&x[1]==y[1])return; int md=(l+r)>>1; divide(l,md); divide(md+1,r); } int find_best(int n){ MAX=0; res=-1; for(int i=0;i<min(n,500);i++){ vector<int>x=ask(i); if(x[0]+x[1]==0)return i; MAX=max(MAX,x[0]+x[1]); } divide(500,n-1); return res; }

Compilation message (stderr)

/usr/bin/ld: /tmp/ccOg1D8a.o: in function `ask(int)':
grader.cpp:(.text+0x80): multiple definition of `ask(int)'; /tmp/ccWidRE9.o:prize.cpp:(.text+0xa0): first defined here
/usr/bin/ld: /tmp/ccOg1D8a.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccWidRE9.o:prize.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status