# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
118367 | baqargam | Cave (IOI13_cave) | C++14 | 813 ms | 640 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>
#include "cave.h"
using namespace std;
int n,comb[5005],fx[5005],S[5005],D[5005],rd[5005];
vector<int>v;
void set_init(int k){
for(int i=0;i<k;i++){
comb[D[i]]=S[i];
fx[D[i]]=1;
}
v.clear();
for(int i=0;i<n;i++){
if(!fx[i])v.push_back(i);
}
}
void set2(int m,int i){
for(int j=0;j<m;j++){
comb[v[j]]=S[i];
}
for(int j=m;j<v.size();j++){
comb[v[j]]=S[i];
}
}
void exploreCave(int N) {
n=N;
for(int i=0;i<n;i++){
set_init(i);
int fr=tryCombination(comb);
if(fr>i)
S[i]=1;
else
S[i]=0;
int l=0,r=v.size();
while(r-l>1){
int m=(l+r)/2;
set2(m,i);
fr=tryCombination(comb);
if(fr>i) r=m; else l=m;
}
D[i]=v[l];
}
for(int i=0;i<n;i++){
rd[D[i]]=i;
}
answer(S,rd);
}
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... |