Submission #138939

# Submission time Handle Problem Language Result Execution time Memory
138939 2019-07-31T02:44:00 Z baluteshih Hotter Colder (IOI10_hottercolder) C++14
0 / 100
10000 ms 8184 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)
{
	srand(chrono::system_clock::now().time_since_epoch().count());
	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=t;
			if(t==0)
			{
				l=r=m;
				break;
			}
			else if(t==1) l=m;
			else r=m; 
		}
		else
		{
			t=Guess(l),ls=t;
			if(t==0)
			{
				l=r=m;
				break;
			}
			else if(t==1) r=m;
			else l=m; 
		}
	}
	return l;
}

Compilation message

hottercolder.cpp: In function 'int HC(int)':
hottercolder.cpp:22:10: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   int m=l+r>>1,t;
         ~^~
hottercolder.cpp:23:5: warning: suggest explicit braces to avoid ambiguous 'else' [-Wdangling-else]
   if(ls!=l&&ls!=r)
     ^
# Verdict Execution time Memory Grader output
1 Execution timed out 10036 ms 1272 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 10026 ms 1272 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 10023 ms 1272 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 10086 ms 8184 KB Time limit exceeded