제출 #1269848

#제출 시각아이디문제언어결과실행 시간메모리
1269848glupanpopa (BOI18_popa)C++20
100 / 100
26 ms424 KiB
#include <bits/stdc++.h>
#include "popa.h"
using namespace std;

int solve(int N, int* Left, int* Right) {
    stack<int>s;
    s.push(0);
    for(int i=0; i<N; i++) {
        Left[i] = -1;
        Right[i] = -1;
    }
    for(int i=1; i<N; i++) {
        int last=-1;
        while(s.size() and query(s.top(), i, i, i)) {
            last=s.top();
            s.pop();
        }
        Left[i] = last;
        if(s.size()) Right[s.top()] = i;
        s.push(i);
    }
    while(s.size() > 1) s.pop();
    return s.top();
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...