# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|
492479 | | 1ne | 동굴 (IOI13_cave) | C++14 | | 206 ms | 588 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;
void exploreCave(int n) {
/* ... */
int cur = 0;
int swit[n] = {-1};
int ans[n] = {0};
while(cur<n){
int left = 0,right = n-1;
int val = -1;
for (int j = 0;j<2;++j){
int temp[n] = {0};
int mid = (left + right)>>1;
for (int i = 0;i<mid;++i){
if (swit[i]==-1){
temp[i] = j;
}
else temp[i] = ans[i];
}
for (int i = mid;i<n;++i){
if (swit[i]==-1){
temp[i] = j;
}
else{
temp[i] = ans[i];
}
}
int a = tryCombination(temp);
if (a>cur){
val = j;
break;
}
}
while(left<=right){
assert(val!=-1);
int temp[n] = {0};
int mid = (left + right)>>1;
for (int i = 0;i<mid;++i){
if (swit[i]==-1){
temp[i] = val;
}
else temp[i] = ans[i];
}
for (int i = mid;i<n;++i){
if (swit[i]==-1){
temp[i] = val^1;
}
else temp[i] = ans[i];
}
int a = tryCombination(temp);
if (a>cur){
right = mid-1;
}
else{
left = mid;
}
}
swit[left] = cur;
ans[left] = val;
++cur;
}
answer(ans,swit);
}
# | 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... |