이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "popa.h"
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <stack>
using namespace std;
#define endl '\n'
#define ll long long
#define pi pair<int, int>
#define f first
#define s second
int qry(int x, int y){
return query(x, x, min(x, y), max(x, y));
}
int solve(int n, int l[], int r[]){
stack<int> stk;
for(int i = 0; i < n; i++){
int x;
l[i] = r[i] = -1;
while(!stk.empty() && qry(i, x = stk.top())){
l[i] = x;
stk.pop();
}
if(!stk.empty()){
//if(!qry(x = stk.top(), i)) return -1;
r[x] = i;
}
stk.push(i);
}
while(stk.size() > 1) stk.pop();
return stk.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... |