Submission #79982

# Submission time Handle Problem Language Result Execution time Memory
79982 2018-10-17T20:08:54 Z giorgikob Cave (IOI13_cave) C++14
12 / 100
241 ms 644 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;//daxuruli
		if(x==-1 || x>i)k=true;//ghia 
		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;//daxuruli
			if(x==-1 || x>i)
			w=true;//ghia
			
			if(k!=w)
			R=mid-1,ind=mid;
			else
			L=mid+1;
			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 Correct 127 ms 512 KB Output is correct
2 Correct 111 ms 508 KB Output is correct
3 Correct 169 ms 512 KB Output is correct
4 Correct 136 ms 504 KB Output is correct
5 Correct 189 ms 644 KB Output is correct
6 Correct 166 ms 516 KB Output is correct
7 Correct 162 ms 552 KB Output is correct
8 Correct 5 ms 452 KB Output is correct
9 Correct 5 ms 512 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 5 ms 384 KB Output is correct
12 Correct 183 ms 512 KB Output is correct
13 Correct 166 ms 532 KB Output is correct
14 Correct 196 ms 512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 241 ms 528 KB Output is correct
2 Correct 6 ms 384 KB Output is correct
3 Incorrect 40 ms 504 KB Answer is wrong
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 512 KB Output is correct
2 Correct 6 ms 512 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Incorrect 5 ms 384 KB Answer is wrong
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 512 KB Output is correct
2 Correct 6 ms 512 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Incorrect 5 ms 384 KB Answer is wrong
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 127 ms 512 KB Output is correct
2 Correct 111 ms 508 KB Output is correct
3 Correct 169 ms 512 KB Output is correct
4 Correct 136 ms 504 KB Output is correct
5 Correct 189 ms 644 KB Output is correct
6 Correct 166 ms 516 KB Output is correct
7 Correct 162 ms 552 KB Output is correct
8 Correct 5 ms 452 KB Output is correct
9 Correct 5 ms 512 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 5 ms 384 KB Output is correct
12 Correct 183 ms 512 KB Output is correct
13 Correct 166 ms 532 KB Output is correct
14 Correct 196 ms 512 KB Output is correct
15 Correct 241 ms 528 KB Output is correct
16 Correct 6 ms 384 KB Output is correct
17 Incorrect 40 ms 504 KB Answer is wrong
18 Halted 0 ms 0 KB -