이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "cave.h"
using namespace std;
void exploreCave(int N) {
int combination[N];
memset(combination, false, sizeof(combination));
bool found[N];
memset(found, false, sizeof(found));
int connection[N];
memset(connection, 0, sizeof(connection));
bool foundswitch[N];
memset(foundswitch, 0, sizeof(foundswitch));
int n = N;
for(int i=0;i<N;i++) {
int st = tryCombination(combination);
if(st == -1) st = n;
for(int j=0;j<N;j++) {
if(found[j]) continue;
combination[j] = true;
int x = tryCombination(combination);
if(x == -1) x = n;
combination[j] = false;
//cout<<j<<" - "<<x<<" and "<<st<<"\n";
if(x == st) continue;
else if(x < st && !foundswitch[x]) {
// we have closed the x'th door
found[j] = true;
combination[j] = false;
connection[j] = x;
foundswitch[x] = true;
}
else if(x > st && !foundswitch[st]) {
found[j] = true;
combination[j] = true;
connection[j] = st;
foundswitch[st] = true;
// we have opened the st'th door
}
}
}
answer(combination, connection);
}
# | 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... |