# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
598414 | Koosha_mv | Cave (IOI13_cave) | C++14 | 397 ms | 560 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;
#define dbgv(v) cout<<#v<<" = "; f(i,0,int(v.size())) cout<<v[i]<<" "; cout<<endl
#define dbga(a,x,y) cout<<#a<<" = "; f(i,x,y) cout<<a[i]<<" "; cout<<endl
#define erorp(x) cout<<#x<<"={"<<x.F<<" , "<<x.S<<"}"<<endl
#define eror(x) cout<<#x<<'='<<(x)<<endl
#define f_(i,a,b) for(int i=a;i>=b;i--)
#define f(i,a,b) for(int i=a;i<b;i++)
#define nb(x) __builtin_popcount(x)
#define all(v) v.begin(),v.end()
#define bit(n,k) (((n)>>(k))&1)
#define Add(x,y) x=(x+y)%mod
#define maxm(a,b) a=max(a,b)
#define minm(a,b) a=min(a,b)
#define lst(x) x[x.size()-1]
#define sz(x) int(x.size())
#define mp make_pair
#define ll long long
#define pb push_back
#define S second
#define F first
const int N=5050;
int n,p[N],mark[N],state[N];
void exploreCave(int _n) {
n=_n;
vector<int> vec(n);
iota(all(vec),0);
while(vec.size()){
f(i,0,n) mark[i]=state[i];
int now=tryCombination(mark);
int l=0,r=vec.size();
while(l+1<r){
int mid=(l+r)>>1;
f(i,0,vec.size()) mark[vec[i]]=(i<mid);
if(tryCombination(mark)==now){
l=mid;
}
else{
r=mid;
}
}
f(i,0,vec.size()) mark[vec[i]]=(i<r);
int prt=tryCombination(mark);
int id=vec[l];
if(prt==-1 || prt>now){
p[id]=now;
state[id]=1;
}
else{
p[id]=prt;
state[id]=0;
}
vec.erase(vec.begin()+l);
}
answer(state,p);
}
//tryCombination
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... |