Submission #1038515

# Submission time Handle Problem Language Result Execution time Memory
1038515 2024-07-29T21:49:17 Z attky Cave (IOI13_cave) C++17
0 / 100
27 ms 348 KB
#include <bits/stdc++.h>
#include "cave.h"
 
using namespace std;

void exploreCave(int n) {
    int state[n], pos[n];
    bool good[n];
    for(int loop = 0; loop < n; ++loop) {
        good[loop] = false;
        pos[loop] = -1;
    }
    for(int loop = 0; loop < n; ++loop) {
        for(int looping = 0; looping < n; ++looping) {
            if(!good[looping]) {
                state[looping] = 1;
            }
        }
        int ans = tryCombination(state)-1;
        if(ans < 0) {
            ans = 2e9;
        }
        bool closed = (ans == loop);
        int deb = 0, fin = n-1;
        while(fin-deb > 0) {
            int mid = (deb+fin)/2;
            for(int looping = mid+1; looping <= fin; ++looping) {
                if(!good[looping]) {
                    state[looping] = 1-state[looping];
                }
            }
            int newAns = tryCombination(state)-1;
            if(newAns < 0) {
                newAns = 2e9;
            }
            bool newClosed = (ans == loop);
            if((newClosed && closed) || (!newClosed && !closed)) {
                fin = mid;
            }
            else {
                deb = mid+1;
            }
        }
        good[deb] = true;
        pos[deb] = loop+1;
    }
    answer(state, pos);
}
# Verdict Execution time Memory Grader output
1 Incorrect 22 ms 348 KB Answer is wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 27 ms 348 KB Answer is wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Answer is wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Answer is wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 22 ms 348 KB Answer is wrong
2 Halted 0 ms 0 KB -