Submission #137052

# Submission time Handle Problem Language Result Execution time Memory
137052 2019-07-27T03:00:20 Z tinjyu Hotter Colder (IOI10_hottercolder) C++14
50 / 100
754 ms 8312 KB
#include "grader.h"
#include <iostream>
using namespace std;
int HC(int N){
    if(N==1)return 1;
	long long int n=N;
	int mid=n/2;
	long long int l=1,r=n,a=-1,pre=n;
	while(true)
	{
        long long int tmp;
        if(a==0)
        {
            if(mid<pre)
            {
                pre=l;
                mid=r;
            }
            else{
                pre=r;
                mid=l;
            }
        }
        else
        {
            Guess(r);
            pre=r;
            mid=l;
        }
        tmp=Guess(mid);

        //cout<<l<<" "<<r<<" "<<mid<<" "<<pre<<" "<<tmp<<endl;
        if(tmp==1)
        {
            if(pre>mid)
            {
                r=(mid+pre)/2;
                if((mid+pre)%2==0)r--;
                if(l==mid)a=0;
                else a=1;
            }
            else
            {
                l=(mid+pre)/2+1;
                if(r==mid)a=0;
                else a=1;
            }
        }
        if(tmp==-1)
        {
            if(pre>mid)
            {
                l=(mid+pre)/2+1;
                if(r==mid)a=0;
                else a=1;
            }
            else
            {
                r=(mid+pre)/2;
                if((mid+pre)%2==0)r--;
                if(l==mid)a=0;
                else a=1;
            }
        }
        if(tmp==0)return (mid+pre)/2;
	}
}
# Verdict Execution time Memory Grader output
1 Correct 27 ms 1272 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 27 ms 1272 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 28 ms 1272 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 754 ms 8312 KB Output isn't correct - alpha = 0.000000000000