Submission #976544

#TimeUsernameProblemLanguageResultExecution timeMemory
976544LaviniaTornaghiHotter Colder (IOI10_hottercolder)C++14
25 / 100
446 ms8236 KiB
#include <bits/stdc++.h> using namespace std; #include "grader.h" int n; int rec(int l, int r, bool isl){ //l'ultima query e' stata fatta a sx -> quella dopo su dx if(r-l==1){ if(isl){ if(Guess(r)==-1) return l; return r; }else{ if(Guess(l)==-1) return r; return l; } } int g; if(isl) g=Guess(r); else g=Guess(l); if(g==0) return (l+r)/2; if(isl){ if(g==1){ return rec((l+r)/2,r,0); } else{ Guess(l); return rec(l,min(n,(l+r)/2),1); } }else{ if(g==-1){ Guess(r); return rec((l+r)/2,r,0); } else { return rec(l,min(n,(l+r)/2),1); } } } int HC(int N){ n=N; Guess(1); return rec(1,N,1); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...