Submission #79981

# Submission time Handle Problem Language Result Execution time Memory
79981 2018-10-17T19:59:36 Z giorgikob Cave (IOI13_cave) C++14
0 / 100
174 ms 512 KB
#include "cave.h"
#include<bits/stdc++.h>
int ans[50005],ans1[50005],S[50005],fix[50005];
void exploreCave(int N) {
    for(int i=0;i<N;i++)
    {
    	for(int j=0;j<N;j++)
    	if(fix[j]==1)
    	S[j]=ans[j];
    	else
    	S[j]=0;
    	
		int x=tryCombination(S);
		bool k=false;
		if(x==-1 || x>i)k=true; 
		int L=i,R=N-1,ind=0;
		while(L<=R)
		{
			int mid=(L+R)/2;
			for(int j=L;j<=mid;j++)
			if(fix[j]==0)
			S[j]=1-S[j];
			
			x=tryCombination(S);
			bool w=false;
			if(x==-1 || x>i)
			w=true;
			
			if(k!=w)
			R=mid-1;
			else
			L=mid+1,ind=mid;
			k=w;
		}
		ans1[ind]=i;fix[ind]=1;
		(k==true)?ans[ind]=S[i]:ans[ind]=1-S[i];
	}
	
	answer(ans,ans1);
}
# Verdict Execution time Memory Grader output
1 Incorrect 26 ms 512 KB Answer is wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 174 ms 384 KB Answer is wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 384 KB Answer is wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 384 KB Answer is wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 26 ms 512 KB Answer is wrong
2 Halted 0 ms 0 KB -