Submission #306414

# Submission time Handle Problem Language Result Execution time Memory
306414 2020-09-25T13:16:35 Z amunduzbaev Cave (IOI13_cave) C++14
0 / 100
217 ms 504 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 j=0;j<n-1;j++){
        if(ret==-1||ret>j)
            prevdopen=1;
        else
            prevdopen=0;
        int l=-1,r=n;
        while(r-l>1){
            int m=(l+r)/2;
            for(int i=l+1;i<=m;i++){
                if(used[i])
                    continue;
                s[i]=!s[i];
            }
            ret=tryCombination(s);
            if(ret==-1||ret>j)
                dopen=1;
            else
                dopen=0;
            if(dopen==prevdopen)
                l=m;
            else
                r=m;
            prevdopen=dopen;
        }

        d[r]=j;
        used[r]=1;
        if(!dopen){
            s[r]=!s[r];
            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 217 ms 504 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 -