Submission #1137993

#TimeUsernameProblemLanguageResultExecution timeMemory
1137993thangdz2k7popa (BOI18_popa)C++20
100 / 100
26 ms424 KiB
#include "popa.h"
#include <bits/stdc++.h>

using namespace std;

const int N = 1005;

int s[N], c;

int solve(int n, int *l, int *r){
    int root = -1, c = 0;
    for (int u = 0; u < n; ++ u){
        l[u] = r[u] = -1;
        while (c && query(s[c], u, u, u)){
            r[s[c]] = l[u];
            l[u] = s[c];
            c --;
        }
        if (!c) root = u;
        else r[s[c]] = u;
        s[++ c] = u;
    }

    return root;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...