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>
using namespace std;
void exploreCave(int N) {
int a[N], b[N], c[N];
for(int i=0;i<N;i++) a[i] = b[i] = c[i] = -1;
for(int i=0;i<N;i++) {
vector<int> v;
for(int j=0;j<N;j++) if(b[j] == -1) {
a[j] = 0, v.push_back(j);
}
int re = tryCombination(a);
int flag = (re < 0 || re > i ? 0 : 1);
for(int j : v) a[j] = flag;
assert(-1 == tryCombination(a) || tryCombination(a) > i);
for(int x : v) {
a[x] = !flag;
if(-1 < re && re <= i) {
c[x] = i;
b[x] = a[x] = flag;
break;
}
}
// while(v.size() > 1) {
// int mid = v.size()/2;
// for(int i=0;i<v.size();i++) a[v[i]] = (i < mid) ^ flag;
// int re = tryCombination(a);
// for(int i=0;i<v.size();i++) a[v[i]] = flag;
// if(re == -1 || re > i) v = vector(v.begin()+mid, v.end());
// else v = vector(v.begin(), v.begin()+mid);
// }
// c[v[0]] = i, b[c[i]] = a[c[i]] = flag;
}
answer(b, c);
}
# | 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... |