# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
104349 | tmk | popa (BOI18_popa) | C++17 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#include"pop.h"
using namespace std;
#ifndef d
#define d(...)
#endif
#define st first
#define nd second
#define pb push_back
#define siz(c) (int)(c).size()
#define all(c) (c).begin(), (c).end()
typedef long long LL;
typedef long double LD;
constexpr int INF=1e9+7;
constexpr LL INFL=1e18;
template<class L, class R> ostream &operator<<(ostream &os, pair<L,R> P) {
return os << "(" << P.st << "," << P.nd << ")";
}
int solve(int n, int *L, int *R) {
fill_n(L, n, -1);
fill_n(R, n, -1);
int top = 0, cur = 0, lst = 0;
while(cur < n-1) {
if(query(cur, cur, cur, cur+1)) {
if(lst != cur)
R[lst] = cur;
lst = cur++;
}
else if(query(top, cur+1, cur+1, cur+1)) {
if(lst != cur)
R[lst] = cur;
L[cur+1] = top;
top = lst = ++cur;
} else {
L[cur+1] = cur;
cur++;
}
}
if(lst != cur) R[lst] = cur;
return top;
}