# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
429865 | Dakto | Cave (IOI13_cave) | C++17 | 1282 ms | 528 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>
using namespace std;
int S[5000], D[5000];
void exploreCave(int n) {
vector<int> switches(n,-1),indices(n,-1);
for(int i=0; i<n; i++){
for(int j=0; j<n; j++) S[j]=(switches[j]==1);
bool correct=!(i!=tryCombination(S));
vector<int> fr;
for(int j=0; j<n; j++){
if(switches[j]==-1) fr.push_back(j);
}
while(fr.size()>1){
vector<int> v1,v2;
for(int j=0; j<fr.size(); j++){
if(j%2) v1.push_back(fr[j]);
else v2.push_back(fr[j]);
}
for(int j=0; j<n; j++) S[j]=(switches[j]==-1?!correct:switches[j]);
for(auto j:v1) S[j]=correct;
if(tryCombination(S)==i) fr=v2;
else fr=v1;
}
switches[fr[0]]=correct;
indices[fr[0]]=i;
}
for(int j=0; j<n; j++) S[j]=(switches[j]==1);
for(int j=0; j<n; j++) D[j]=indices[j];
answer(S,D);
}
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... |