Submission #403986

# Submission time Handle Problem Language Result Execution time Memory
403986 2021-05-13T16:18:34 Z Antekb Hotter Colder (IOI10_hottercolder) C++14
90 / 100
727 ms 9060 KB
#include "grader.h"
#include<bits/stdc++.h>
using namespace std;
int HC(int N){
	if(N==1)return 1;
   	int l=1, r=N;
   	int lst, akt;
   	akt=(l+r+1)/2-1;
   	Guess(akt);
   	int x=1, y=3;
   	while(l<r){
   		//cout<<lst<<" "<<akt<<" "<<l<<" "<<r<<"\n";
   		lst=akt;
   		if(lst<l)akt=r-(r-l)*x/y;
   		else if(lst>r)akt=l+(r-l)*x/y;
   		else{
   			akt=l+r-lst;
   			if(lst-l<(r-l)/4)akt-=(r-l)/4;
   			if(r-lst<(r-l)/4)akt+=(r-l)/4;
   			if(akt==lst){
   				if(akt==l)akt++;
   				else akt--;
   			}
   		}
   		/*akt=(l+r+1)/2;
   		if(akt==lst)akt--;*/
   		int k=Guess(akt);
   		//cout<<lst<<" "<<akt<<" "<<l<<" "<<r<<"\n";
   		if(k==0)return (lst+akt)>>1;
   		if((akt<lst) ^ (k==1))l=max((lst+akt+2)/2, l);
   		else r=min(r, (lst+akt-1)/2);
   	}
   	return l;
}
# Verdict Execution time Memory Grader output
1 Correct 26 ms 1228 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 26 ms 1296 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 26 ms 1300 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 727 ms 9060 KB Output is partially correct - alpha = 0.600000000000