# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
987636 | Tsagana | Cave (IOI13_cave) | C++14 | 837 ms | 800 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "cave.h"
#include<bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define pq priority_queue
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define eb emplace_back
#define F first
#define S second
using namespace std;
bitset<5069> spc;
int n, a[5001], sq[5001];
int qr(int ky, int x) {
for (int i = 0; i < n; i++) {
if (sq[i] < n) a[i] = spc[sq[i]];
else a[i] = ky ^ i <= x;
}
return tryCombination(a);
}
void exploreCave(int N) {
int rh, md, zz; n = N;
for (int i = 0; i < n; i++) sq[i]=n;
for (int i = 0; i < n; i++) {
spc[i] = (qr(1, n-1) == i);
for (int lh = 0, rh = n-1; lh <= rh;) {
md = (lh + rh) / 2;
if (qr(spc[i], md) == i) {zz = md; rh = md-1;}
else lh = md + 1;
}
sq[zz] = i;
}
for (int i = 0; i < n; i++) a[i] = spc[sq[i]];
answer(a, sq);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |