# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
245988 | kimbj0709 | Cave (IOI13_cave) | C++14 | 346 ms | 760 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<bits/stdc++.h>
using namespace std;
#include "cave.h"
void exploreCave(int N) {
vector<int> ans(N);
int pos[N];
for(int i=0;i<N;i++){
pos[i] = 0;
}
deque<int> currelem;
for(int i=0;i<N;i++){
currelem.push_back(i);
}
for(int i=0;i<N;i++){
int rn = tryCombination(pos);
if(rn==-1||rn>i){
}
else{
for(auto k:currelem){
pos[k] ^= 1;
}
}
deque<int> curr = currelem;
while(curr.size()>1){
int mid = (curr.size()+1)/2;
for(int j=0;j<mid;j++){
pos[curr[j]] ^= 1;
}
int idk = tryCombination(pos);
for(int j=0;j<mid;j++){
pos[curr[j]] ^= 1;
}
if(idk==-1||idk>i){
for(int j=0;j<mid;j++){
curr.pop_front();
}
}
else{
int sss = curr.size();
for(int j=sss-1;j>=mid;j--){
curr.pop_back();
}
}
}
int p = 0;
for(int j=0;j<currelem.size();j++){
if(currelem[j]==curr[0]){
p = j;
}
}
ans[curr[0]] = i;
currelem.erase(currelem.begin()+p);
}
int temp1[N];
for(int i=0;i<N;i++){
temp1[i] = ans[i];
}
answer(pos,temp1);
return;
}
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... |