이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "cave.h"
#include <bits/stdc++.h>
using namespace std;
void exploreCave(int N) {
int n = N;
vector<int> done(N), ans(N), door(N);
for(int i = 0; i < n; i ++){
int k = tryCombination(ans.data());
// cout << k << endl;
if(k == i){
int l = 0, r = n - 1;
while(l != r){
int m = (l+r)/2;
for(int j = l; j <= m; j ++){
if(!done[j]) ans[j] = 1;
}
int tem = tryCombination(ans.data());
for(int j = l; j <= m; j ++){
if(!done[j]) ans[j] = 0;
}
if(tem == -1) tem = n;
if(tem > i){
r = m;
}else l = m + 1;
}
door[r] = i;
done[r] = 1;
ans[r] = 1;
// cout << r << " r2" << endl;
}else{
int l = 0, r = n - 1;
while(l != r){
int m = (l+r)/2;
for(int j = l; j <= m; j ++){
if(!done[j]) ans[j] = 1;
}
int tem = tryCombination(ans.data());
for(int j = l; j <= m; j ++){
if(!done[j]) ans[j] = 0;
}
if(tem == -1) tem = n;
if(tem == i){
r = m;
}else l = m + 1;
} //cout << r << "r1 " << endl;
door[r] = i;
done[r] = 1;
ans[r] = 0;
//ans[r] = 0; cout << ans[r] << endl;
}
}
// for(auto u : ans) cout << u << ' ' ; cout << endl;
// for(auto u : door) cout << u << ' ' ; cout << endl;
answer(ans.data(), door.data());
}
# | 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... |