Submission #138956

# Submission time Handle Problem Language Result Execution time Memory
138956 2019-07-31T03:27:08 Z baluteshih Hotter Colder (IOI10_hottercolder) C++14
50 / 100
1002 ms 8252 KB
#include "grader.h"
#include <stdlib.h>
#include <chrono>
#define jizz ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define pb push_back
#define ET cout << "\n"
#define F first
#define S second
#define MP make_pair
#define ALL(v) v.begin(),v.end()
#define MEM(i,j) memset(i,j,sizeof i)
#define DB(a,s,e) {for(int i=s;i<e;++i) cout << a[i] << " ";ET;}
using namespace std;
typedef long long ll;

int HC(int N)
{
	int l=1,r=N,ls=-1;
	while(l<r)
	{
		int m=l+r>>1,t;
		if(ls!=l&&ls!=r)
			if(rand()%2) Guess(l),ls=l;
			else Guess(r),ls=r;
		if(ls==l)
		{
			t=Guess(r),ls=r;
			if(t==0)
			{
				l=r=m;
				break;
			}
			else if(t==1) l=m+1;
			else r=m; 
		}
		else
		{
			t=Guess(l),ls=l;
			if(t==0)
			{
				l=r=m;
				break;
			}
			else if(t==1) r=m;
			else l=m+1; 
		}
	}
	return l;
}

Compilation message

hottercolder.cpp: In function 'int HC(int)':
hottercolder.cpp:21:10: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   int m=l+r>>1,t;
         ~^~
hottercolder.cpp:22:5: warning: suggest explicit braces to avoid ambiguous 'else' [-Wdangling-else]
   if(ls!=l&&ls!=r)
     ^
# Verdict Execution time Memory Grader output
1 Correct 45 ms 1272 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 39 ms 1272 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 40 ms 1272 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 1002 ms 8252 KB Output isn't correct - alpha = 0.000000000000