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) {
set<int> DONTTOUCH;
vector<pair<int, int>> setted;
int comp[n];
for(int i = 0; i < n; i++){
comp[i] = 0;
}
for(int k = 1; k <= n; k++){
int newguy = 0;
for(int i = 0; i < n; i++){
comp[i] = 0;
}
for(auto e : setted){
int idx = e.first;
int pos = e.second;
comp[idx] = pos;
}
//to vendo a kesima porta
int fst = tryCombination(comp);
for(int j = 13; j >= 0; j--){
for(int i = 0; i < n; i++){
if(!DONTTOUCH.count(i)){
if(i & (1 << j)){
comp[i] = 1;
} else {
comp[i] = 0;
}
}
}
int nd = tryCombination(comp);
if(((fst <= k) and (nd <= k)) or ((fst > k) and (nd > k))){
newguy *= 2;
} else {
newguy *= 2;
newguy++;
}
}
DONTTOUCH.insert(newguy);
if(fst <= k){
setted.push_back({newguy, 1});
} else {
setted.push_back({newguy, 0});
}
}
int a[n], b[n];
for(int i = 0; i < n; i++){
int idx = setted[i].first;
int pos = setted[i].second;
a[i] = idx;
b[i] = pos;
}
answer(a, b);
}
# | 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... |