This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#include<popa.h>
using namespace std;
const int N = 1005;
int le[N], ri[N];
int solve(int n, int *le, int *ri){
    for(int i = 0; i < n; i++){
        le[i] = ri[i] = -1;
    }
    vector < int > st;
    for(int i = 0; i < n; i++){
        while(!st.empty() && query(st.back(), i, i, i) == true){
            ri[st.back()] = le[i];
            le[i] = st.back();
            st.pop_back();
        }
        st.push_back(i);
    }
    while((int)st.size() > 1){
        ri[st[(int)st.size() - 2]] = st.back();
        st.pop_back();
    }
    return st[0];
}
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... |