# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
92884 | 2019-01-05T12:17:56 Z | Pajaraja | popa (BOI18_popa) | C++17 | 0 ms | 0 KB |
#include <bits/stdc++.h> #include "popa.h" #define MAXN 1007 using namespace std; int ls[MAXN],rs[MAXN]; int rek(int lt,int rt) { if(lt>rt) return -1; int l=lt,r=rt; while(l!=r) { int s=(l+r)/2; if(Query(lt,rt,lt,s)) r=s; else l=s+1; } ls[l]=rek(lt,l-1); rs[l]=rek(rt,l+1); return l; } int solve(int N,int* Left,int* Right) { int a=rek(0,N-1); for(int i=0;i<N;i++) Left[i]=ls[i]; for(int i=0;i<N;i++) Right[i]=rs[i]; return a; }