Submission #1229931

#TimeUsernameProblemLanguageResultExecution timeMemory
1229931Ghulam_Junaidpopa (BOI18_popa)C++20
61 / 100
90 ms496 KiB
#include <bits/stdc++.h>
#include "popa.h"
using namespace std;

const int N = 1005;
int n;

int dnc(int l, int r, int* lc, int* rc){
    if (l > r) return -1;
    int lo = l - 1, hi = r;
    while (hi - lo > 1){
        int mid = (lo + hi) / 2;
        if (query(l, mid, l, r))
            hi = mid;
        else
            lo = mid;
    }

    int root = hi;
    lc[root] = dnc(l, root - 1, lc, rc);
    rc[root] = dnc(root + 1, r, lc, rc);
    return root;
}

int solve(int nn, int* Left, int* Right){
    n = nn;
    return dnc(0, n - 1, Left, Right);
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...