제출 #73176

#제출 시각아이디문제언어결과실행 시간메모리
73176TuGSGeReLCave (IOI13_cave)C++14
0 / 100
344 ms580 KiB
#include "cave.h"
#include<bits/stdc++.h>
#define ll int
#define mp make_pair
#define pub push_back
#define pob pop_back
#define ss second
#define ff first
#define ext exit(0)
using namespace std;
ll i,j,ans[5001],pos[5001],ask[5001],k,l,r;
bool boo[5001];
void exploreCave(int n) {
	memset(boo,-1,sizeof boo);
	for(i=0;i<n;i++){
		for(j=0;j<n;j++){
			if(boo[i]==-1) ask[i]=0;
			else ask[i]=ans[i];
		}
		k=tryCombination(ask);
		if(k!=i) ans[i]=ask[i];
		else ans[i]=1-ask[i];
		l=0,r=n;
		while(l+1<r){
			ll mid=(l+r)/2;
			for(j=0;j<n;j++){
				if(j<=mid) ask[i]=ans[i];
				else ask[i]=1-ans[i];
			}
			k=tryCombination(ask);
			if(k!=i){
				l=mid;
			}
			else r=mid;
		}
		pos[i]=l;
	}
	answer(ans,pos);
}

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

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:17:13: warning: comparison of constant '-1' with boolean expression is always false [-Wbool-compare]
    if(boo[i]==-1) ask[i]=0;
       ~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...