Submission #34807

# Submission time Handle Problem Language Result Execution time Memory
34807 2017-11-15T20:09:08 Z SYury Cave (IOI13_cave) C++11
0 / 100
555 ms 512 KB
#include "cave.h"
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double dbl;
typedef pair<int, int> pii;


#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define sqr(x) (x)*(x)
#define F(i, l, r) for(int i = (l); i < (r); i++)
#define DF(i, l, r) for(int i = (l); i > (r); i--)
#define I(x, a) for(auto x : (a))
#define mp make_pair
#define X first
#define Y second
#define clean(x) memset((x), 0, sizeof(x))
#define ret return
#define cont continue
#define brk break
#define ins insert
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define sync ios_base::sync_with_stdio(false);cin.tie(0)
#define pb push_back
#define fin(x) freopen(x, "r", stdin)
#define fout(x) freopen(x, "w", stdout)
#define y1 fjfg

const int maxn = 5e3 + 3;

int state[maxn], known[maxn];
int what[maxn];
int unused[maxn];

void exploreCave(int n){
	F(i, 0, n)state[i] = 0;
	F(i, 0, n)known[i] = -1;
	F(i, 0, n){
		int ptr = 0;
		F(j, 0, n)if(known[j] == -1)unused[ptr++] = j;
		F(j, 0, n)if(known[j] != -1){state[j] = known[j];}else{state[j] = 0;}
		int init = tryCombination(state);
		bool open = init > i;
		int l = 0, r = ptr - 1;
		while(r > l){
			int mid = (l + r) >> 1;
			int pos = unused[mid];
			F(j, 0, n)if(known[j] != -1){state[j] = known[j];}else{state[j] = (j <= pos) ? 1 : 0;}
			int res = tryCombination(state);
			bool copen = res > i;
			if(copen != open)r = mid;
			else l = mid + 1;
		}
		what[unused[l]] = i;
		if(open)known[unused[l]] = 0;
		else known[unused[l]] = 1;
	}
	answer(known, what);
}
# Verdict Execution time Memory Grader output
1 Incorrect 309 ms 512 KB Answer is wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 555 ms 500 KB Answer is wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 384 KB Answer is wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 384 KB Answer is wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 309 ms 512 KB Answer is wrong
2 Halted 0 ms 0 KB -