제출 #385809

#제출 시각아이디문제언어결과실행 시간메모리
385809Pichon5Cave (IOI13_cave)C++17
0 / 100
520 ms452 KiB
#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 s[n];
    int d[n];
    int res[n];
    vector<bool>vis(n+1,false);
    for(int i=0;i<n;i++){
        for(int l=0;l<n;l++){
            if(vis[l])continue;
            s[l]=0;
        }
        int x=tryCombination(s);
        int c=1;
        if(x>i or x==-1){
            c=0;
        }
        int b=0,e=n-1;
        int pos=0;
        while(b<=e){
            int mid=(b+e)/2;
            for(int l=0;l<n;l++){
                if(vis[l])continue;
                s[l]=c;
                if(l<b or l>mid)s[l]=!c;
            }
            x=tryCombination(s);
            if(x>i or x==-1){
                pos=b;
                e=mid-1;
            }else{
                b=mid+1;
            }
        }
        vis[pos]=1;
        s[pos]=c;
        res[pos]=c;
        d[pos]=i;
    }
    answer(res,d);
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...