Submission #302120

# Submission time Handle Problem Language Result Execution time Memory
302120 2020-09-18T13:11:33 Z UserIsUndefined Cave (IOI13_cave) C++14
0 / 100
49 ms 584 KB
#include "cave.h"

#include<bits/stdc++.h>


using namespace std;


bool visited[5005];

int doorIisOpendBy[5005];
int c[5005];


void exploreCave(int N) {
    int S[N];




    for (int i = 0 ; i < N ; i++){

        for (int j = 0 ; j < N ; j++){
            if (visited[j] == false){
                S[j] = 1;
            }
        }

        bool close = 0;

        int last = tryCombination(S);

        if (last == i){
            close = 1;
            for (int j = 0 ; j < N ; j++){
                if (visited[j] == false){
                    S[j] = 0;
                }
            }
        }


        int low = 0;
        int high = N - 1;


        while(low < high){
            int mid = (low + high)/2;

            for (int j = low ; j <= mid ; j++){
                if (visited[j] == false){
                    S[j] = close;
                }
            }

            for (int j = mid + 1 ; j <= high ; j++){
                if (visited[j] == false){
                    S[j] = (!close);
                }
            }

            last = tryCombination(S);

            if (last == i){
                high = mid;
            }

            else {
                low = mid + 1;
            }

        }



        visited[low] = true;
        doorIisOpendBy[low] = i;
        c[low] = (!close);






    }


    answer(c , doorIisOpendBy);



}
# Verdict Execution time Memory Grader output
1 Incorrect 33 ms 584 KB Answer is wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 49 ms 512 KB Answer is wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 384 KB Answer is wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 384 KB Answer is wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 33 ms 584 KB Answer is wrong
2 Halted 0 ms 0 KB -