Submission #573949

#TimeUsernameProblemLanguageResultExecution timeMemory
573949Sho10Hotter Colder (IOI10_hottercolder)C++17
0 / 100
589 ms139048 KiB
#include <bits/stdc++.h> //Andrei Alexandru a.k.a Sho #include "grader.h" using ll=long long; using ld=long double; int const INF=1000000005; ll const LINF=1000000000000000005; ll const mod=6700417; ld const PI=3.14159265359; ll const MAX_N=3e5+5; ld const EPS=0.00000001; #pragma GCC optimize("O3") #pragma GCC optimize("Ofast") #define f first #define s second #define pb push_back #define mp make_pair #define endl '\n' #define sz(a) (int)a.size() #define CODE_START ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); using namespace std; int n,check=0,last=-1,cnt=0; ll calc(ll st,ll dr){ return (st+dr)/2; } ll solve(ll l,ll r){ //cout<<l<<' '<<r<<' '<<last<<' '; if(l==r){ return l; } ll mid=(l+r)/2; if(last==1){ mid=(l+r+1)/2; if(mid>r){ mid--; } } //cout<<mid<<endl; if(last==2||last==1){ ll x=Guess(mid); if(x==0){ if(last==1){ return calc(l,mid); }else return calc(mid,r); }else if(x==-1){ if(last==2){ last=1; return solve(mid,r); }else if(last==1){ last=2; return solve(l,mid); } }else if(x==1){ last=-mid; return solve(calc(l,mid),calc(mid+1,r)); } }else if(last!=1&&last!=2){ ll mid=-last; ll x=Guess(r); if(x==0){ return calc(mid,r); }else if(x==1){ last=2; return solve(mid,r); }else { last=1; return solve(l,mid); } } } int HC(int N){ cnt=0; if(N==1){ return 1; } ll x=Guess(N); last=2; ll nr=solve(1,N); return nr; }

Compilation message (stderr)

hottercolder.cpp: In function 'int HC(int)':
hottercolder.cpp:76:4: warning: unused variable 'x' [-Wunused-variable]
   76 | ll x=Guess(N);
      |    ^
hottercolder.cpp: In function 'll solve(ll, ll)':
hottercolder.cpp:70:1: warning: control reaches end of non-void function [-Wreturn-type]
   70 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...