제출 #138939

#제출 시각아이디문제언어결과실행 시간메모리
138939baluteshihHotter Colder (IOI10_hottercolder)C++14
0 / 100
10086 ms8184 KiB
#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;
}

컴파일 시 표준 에러 (stderr) 메시지

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...