Submission #670634

#TimeUsernameProblemLanguageResultExecution timeMemory
670634gustavo_dCave (IOI13_cave)C++17
0 / 100
180 ms428 KiB
#include "cave.h"
#include <bits/stdc++.h>
using namespace std;

void exploreCave(int N) {
    int n = N;
    int confirmed[n];
    int test[n];
    int correspondence[n];
    for (int i = 0; i < n; i++)
        test[i] = 0;
    
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    for(int to_try = 0; to_try<n; to_try++) {
        int l = 0; int r = n;
        while (l != r) {
            int mid = (l+r) / 2;
            for (int i = l; i<r; i++) {
                if (confirmed[i] != -1) test[i] = confirmed[i];
                else {
                    if (i < mid + l) test[i] = 0;
                    else test[i] = 1;
                }
            }
            int tried = tryCombination(test);
            if (to_try != tried) {
                r = mid;
            } else {
                l = mid + 1;
            }
        }
        confirmed[to_try] = l;
        correspondence[l] = to_try;
    }
    answer(confirmed, correspondence);
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...