# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
385807 | Pichon5 | Cave (IOI13_cave) | C++17 | 527 ms | 384 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>
#include <fstream>
#define lcm(a,b) (a/__gcd(a,b))*b
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define pb push_back
#define F first
#define S second
//"\n"
using namespace std;
void exploreCave(int N){
int n=N;
int d[n];
int s[n];
vector<bool>vis(n,false);
for(int i=0;i<n;i++){
int c=0;
for(int l=0;l<n;l++){
if(!vis[l])s[l]=0;
}
int x=tryCombination(s);
if(x==i)c=1;
int b=0,e=n;
int pos;
while(b<=e){
int mid=(b+e)/2;
for(int l=0;l<n;l++){
if(vis[l])continue;
if(l>=b && l<=mid){
s[l]=c;
}else{
s[l]=!c;
}
}
x=tryCombination(s);
if(x>i or x==-1){
pos=b;
e=mid-1;
}else{
b=mid+1;
}
}
//pos es el switch que abrio la puerta
vis[pos]=true;
d[pos]=i;
s[pos]=!c;
}
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... |