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 N 5000
using namespace std;
int get(int s[]){
int ret = tryCombination(s);
if(ret == -1)ret = 1e9;
return ret;
}
void exploreCave(int n) {
int s[n],d[n];
set<int> rem;
for(int i = 0;i<n;i++){
s[i] = 0;
d[i] = -1;
rem.insert(i);
}
for(int i = 0;i<n;i++){
bool val = get(s) > i;
set<int> tmp = rem;
while(tmp.size() > 1){
set<int> a;
while(a.size() < tmp.size()){
a.insert(*tmp.begin());
tmp.erase(*tmp.begin());
}
for(auto u:a){
s[u] = 1;
}
if( (get(s) > i) != val){
tmp = a;
}
for(auto u:a){
s[u] = 0;
}
}
rem.erase(*tmp.begin());
d[*tmp.begin()] = i;
s[*tmp.begin()] = !val;
}
answer(s,d);
}
# | 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... |