Submission #229122

# Submission time Handle Problem Language Result Execution time Memory
229122 2020-05-03T12:28:07 Z huzaifa242 Cave (IOI13_cave) C++14
0 / 100
7 ms 384 KB
/***********************************************************
	When you are inspired by passion 
	and you want to live for the current moment

	When your every thought and action
	has the power to become the story of your future

	When difficulties stand to demolish your Glory
	Just remember that Life is a 'Golden adverse Story'

	Withstand it to acheive your passion and dreams
	more amazingly more easily.

	Why then? When writing the story of your Life
	You want to Let someone else hold your pen

					huzaifa242©

***********************************************************/
#include "cave.h"
#include <bits/stdc++.h>
using namespace std;
#define int int32_t
#define MAX 100005
#define x first 
#define y second

int seed;
mt19937 rng(seed=chrono::steady_clock::now().time_since_epoch().count());
inline int rnd(int l=0,int r=INT_MAX)
{return uniform_int_distribution<int>(l,r)(rng);}

template <typename T,typename G>
ostream& operator << (ostream& out, const pair<T,G> &a) 
{return out<<"( "<<a.x<<", "<<a.y<<")";}

template <typename T>
ostream& operator << (ostream& out, const vector<T> &a) 
{out<<"[ ";for(const auto &i:a)out<<i<<", ";return out<<"]"<<endl;}

template <typename T>
ostream& operator << (ostream& out, const set<T> &a) 
{out<<"{ ";for(const auto &i:a)out<<i<<", ";return out<<"}"<<endl;}

template <typename T,typename G>
ostream& operator << (ostream& out, const map<T,G> &a) 
{out<<"< ";for(const auto &i:a)out<<i<<", ";return out<<">"<<endl;}

template<typename T, size_t N>
typename enable_if<!is_same<typename remove_cv<T>::type, char>::value,
ostream&>::type operator<<(ostream& out, T(&a)[N])
{out<<"[ ";for(size_t i=0;i<N;++i)out<<a[i]<<", ";out <<"]"<<endl;return out;}

void debug_out(){cerr<<endl;} 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T)
{cerr<<(H)<<" ";debug_out(T...);}
 
#ifdef LOCAL
#define debug(...) cerr<<"#"<<#__VA_ARGS__<<":\n",debug_out(__VA_ARGS__)
#else
#define debug(...) 24
#endif

int ask(int n,int a[]){
	int res=tryCombination(a);
	if(res==-1)
		res=n;
	return n;
}

void find(int n, int a[], int d[],int &last){
	for(int i=0;i<n;i++){
		if(d[i]!=-1)
			continue;
		a[i]^=1;
		int now=ask(n,a);
		if(now==last){
			a[i]^=1;
			continue;
		}else if(now>last){
			d[i]=last;
		}else{
			a[i]^=1;
			d[i]=now;
		}
		last=now;
	}
}

void exploreCave(int n){
	int a[n+1],d[n+1],i;
	for(i=0;i<n;i++){
		d[i]=-1;
		a[i]=rnd(0,1);
	}
	int last=ask(n,a);
	for(i=0;i<n;i++){
		if(d[i]==-1)
			find(n,a,d,last);
	}
	answer(a,d);
}
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 384 KB too much calls on tryCombination()
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 384 KB too much calls on tryCombination()
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 256 KB Answer is wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 256 KB Answer is wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 384 KB too much calls on tryCombination()
2 Halted 0 ms 0 KB -