# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
235305 | pere_gil | Cave (IOI13_cave) | C++14 | 6 ms | 512 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 <iostream>
#include "cave.h"
using namespace std;
void exploreCave(int n)
{
///da 25pts
/*
int D[N],S[N];
for(int i=0;i<N;i++){ S[i]=0; }
if(tryCombination(S)==-1){
for(int i=0;i<N;i++){
S[i]=1;
D[i]=tryCombination(S);
S[i]=0;
}
}
else{
for(int i=0;i<N;i++){
D[i]=i;
if(tryCombination(S)==i) S[i]=1;
}
}
answer(S,D);
*/
///fuerza bruta
int s[n],d[n],sw[n];
for(int i=0;i<n;i++){ sw[i]=-2; }
for(int i=0;i<n-1;i++){
for(int j=0;j<n;j++){
sw[j]=0;
if(tryCombination(sw)==i+1){ s[j]=0; d[i]=j; }
else{
sw[j]=1;
if(tryCombination(sw)==i+1){ s[j]=1; d[i]=j; }
else sw[j]=-2;
}
}
}
int ja;
for(int i=0;i<n;i++){ if(sw[i]==-2){ ja=i; } }
s[ja]=0;
if(tryCombination(s)==-1) answer(s,d);
else{ s[ja]=1; 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... |