Submission #306411

# Submission time Handle Problem Language Result Execution time Memory
306411 2020-09-25T13:13:13 Z amunduzbaev Cave (IOI13_cave) C++14
0 / 100
218 ms 384 KB
#include "cave.h"

#include <bits/stdc++.h>
using namespace std;
int s[5005],d[5005],ret;
bool used[5005],prevdopen,dopen;


void exploreCave(int n) {
    memset(d,-1,sizeof(d));
    memset(used,0,sizeof(used));
    ret=tryCombination(s);
    for(int i=0;i<n-1;i++){
        if(ret==-1||ret>i)
            prevdopen=1;
        else
            prevdopen=0;
        int l=0,r=n-1;
        while(l<r){
            int m=(l+r)/2;
            for(int i=l;i<=m;i++){
                if(used[i])
                    continue;
                s[i]=!s[i];
            }
            ret=tryCombination(s);
            if(ret==-1||ret>i)
                dopen=1;
            else
                dopen=0;
            if(dopen==prevdopen)
                l=m+1;
            else
                r=m;
            prevdopen=dopen;
        }

        d[l]=i;
        used[i]=1;
        if(!dopen){
            s[l]=!s[l];
            ret=tryCombination(s);
        }
    }

    answer(s,d);


}

# Verdict Execution time Memory Grader output
1 Incorrect 126 ms 384 KB Answer is wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 218 ms 384 KB Answer is wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Answer is wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Answer is wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 126 ms 384 KB Answer is wrong
2 Halted 0 ms 0 KB -