답안 #403945

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
403945 2021-05-13T15:42:43 Z Antekb Hotter Colder (IOI10_hottercolder) C++14
89 / 100
714 ms 8192 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=2, y=7;
   	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(akt==lst)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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 28 ms 1284 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 25 ms 1292 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 25 ms 1228 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 714 ms 8192 KB Output is partially correct - alpha = 0.555555555556