Submission #501718

# Submission time Handle Problem Language Result Execution time Memory
501718 2022-01-04T11:22:33 Z dnaux Cave (IOI13_cave) C++17
0 / 100
407 ms 384 KB
#include <bits/stdc++.h>
#include "cave.h"
#define endline "\n"
#define pb push_back
#define mp make_pair
#define st first
#define nd second
#define lsb(i) i&(-i)
#define sz(i) (int)i.size()
 
typedef long long ll;
using namespace std;
const ll INF = 1e18L;
constexpr int mod = int(1e9) + 7;
 
ll t=1, n, k, cases = 0; 

void exploreCave(int n){
    int check[n],door[n];
    for(int i = 0; i < n; i++)check[i] = -1;
    for(int i = 0; i < n; i++){

        int S[n] = {};
        for(int i = 0; i < n; i++){
            if(check[i] != -1)S[i] = check[i];
        }

        int cur;
        int bruh = tryCombination(S);
        if(bruh > i or bruh == -1)cur = 0;
        else cur = 1;

        int l = 1, r = n + 1;
        while(r - l > 1){
            int m = (r + l) / 2;

            for(int i = 0; i < n; i++){
                if(check[i] != -1)S[i] = check[i];
                else if(i >= l and i <= m)S[i] = cur;
                else S[i] = cur ^ 1;
            }

            bruh = tryCombination(S);
            if(bruh > i or bruh == -1)r = m;
            else l = m;
        }
        check[l] = cur;
        door[l] = i;
    }
    answer(check, door);
}
# Verdict Execution time Memory Grader output
1 Incorrect 163 ms 332 KB Answer is wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 407 ms 384 KB Answer is wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Answer is wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Answer is wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 163 ms 332 KB Answer is wrong
2 Halted 0 ms 0 KB -