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;
int solve(int N, int* Left, int* Right){
for(int i = 0; i < N; i++) Left[i] = Right[i] = -1;
stack<int> st;
for(int i = 0; i < N; i++){
int pref = -1;
while(!st.empty()){
int First = st.top();
if(query(First, First, First, i)){
Right[First] = i;
break;
}
pref = First;
st.pop();
}
Left[i] = pref;
st.push(i);
}
if(st.empty()) assert(false);
while(st.size() > 1) st.pop();
return st.top();
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |