이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#ifndef LOCAL
#include "popa.h"
#endif // LOCAL
#include <bits/stdc++.h>
using namespace std;
int solve(int N, int *l, int *r){
for(int i = 0 ; i < N ; ++i)l[i] = r[i] = -1;
vector<int> s;
for(int i = 0 ; i < N ; ++i){
int son = -1;
while(s.size() > 0){
int pos = s.back();
while(l[pos] != -1)pos = l[pos];
if(query(pos, i, s.back(), s.back()) == 1){
break;
}else{
son = s.back();
s.pop_back();
}
}
if(s.size())r[s.back()] = i;
l[i] = son;
s.push_back(i);
}
return s[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... |