| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1313988 | coderg | 동굴 (IOI13_cave) | C++20 | 119 ms | 508 KiB |
#include "bits/stdc++.h"
#include "cave.h"
using namespace std;
#define mp make_pair
#define fi first
#define se second
#define pii pair<int,int>
#define yes cout<<"YES\n"
#define no cout<<"NO\n"
#define pb push_back
void setIO(string name = ""){if(name.size()){ freopen((name + ".in").c_str(), "r", stdin);freopen((name + ".out").c_str(), "w", stdout);}}
#define F(i,l,r) for(int i=(l);i<(r);++i)
#define FR(i,l,r) for(int i=(l);i>=(r);--i)
typedef long long ll;
const int maxn=5000;
const int mod=1e9+7;
const int mox=2000*500+505;
const int inf=1e9;
void exploreCave(int N){
int S[maxn],D[maxn];
F(i,0,N)S[i]=0;
vector<int> cand;
cand.reserve(N);
F(i,0,N)cand.pb(i);
F(i,0,N){
int res=tryCombination(S);
int target=(res==-1 || res>i)?0:1;
int l=0,r=cand.size()-1;
while(l<r){
int mid=(l+r)>>1;
if(target==0){
F(k,mid+1,r+1)S[cand[k]]=1;
}else{
F(k,l,mid+1)S[cand[k]]=1;
}
res=tryCombination(S);
if(target==0){
F(k,mid+1,r+1)S[cand[k]]=0;
}else{
F(k,l,mid+1)S[cand[k]]=0;
}
bool isopen=(res==-1 || res>i);
if(isopen)r=mid;
else l=mid+1;
}
int idx=cand[l];
S[idx]=target;
D[idx]=i;
cand[l]=cand.back();
cand.pop_back();
}
answer(S,D);
}
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... | ||||
