Submission #64515

#TimeUsernameProblemLanguageResultExecution timeMemory
64515alenam0161Hotter Colder (IOI10_hottercolder)C++17
83 / 100
2317 ms8188 KiB
#include "grader.h" #include <bits/stdc++.h> using namespace std; int n; int fq=0; int fnd(int l,int r,int lst){ // cout<<l<<" "<<r<<" "<<lst<<endl; if(l==r)return l; else if(r<l)return 1; if(lst<=l){ int x=min(n,l-lst+r); int md=(x+lst)/2; if(md+1<=l){ int a; if(lst==l){ a=Guess(l+1); if(a>0)return fnd(l+1,r,l+1); else return l; } a=Guess(l); return fnd(l,r,l); } int c=Guess(x); if(c==0)return (x+lst)/2; if(c==1){ return fnd(max(md+1,l),r,x); } else{ return fnd(l,min(r,md),x); } } else{ int x=max(1,l-(lst-r)); int md=(x+lst)/2; if(md>=r){ if(lst==r){ int a=Guess(r-1); if(a>0)return fnd(l,r-1,r-1); else return r; } int a= Guess(r); return fnd(l,r,r); } int c=Guess(x); if(c==0)return (x+lst)/2; if(c==1){ return fnd(l,min(r,md),x); } else{ return fnd(max(md+1,l),r,x); } } } int Tg=0; int HC(int N){ Tg++; n=N; srand(Tg*5+41+(Tg<<1)); if(0){ Guess(1); return fnd(1,n,1); } else{ Guess(n); return fnd(1,n,n); } }

Compilation message (stderr)

hottercolder.cpp: In function 'int fnd(int, int, int)':
hottercolder.cpp:41:17: warning: unused variable 'a' [-Wunused-variable]
             int a= Guess(r);
                 ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...