# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
329135 | mat_v | Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) | C++14 | 0 ms | 0 KiB |
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>
#define ff(i,a,b) for(int (i) = (a); (i) <= (b); ++(i))
#define maxn 200005
using namespace std;
int n,m;
int niz[maxn];
int seg[4 * maxn];
vector<int> mst[4 * maxn];
void merg(int x, int y, int z){
int br1 = 0;
int br2 = 0;
int p1 = mst[y].size();
int p2 = mst[z].size();
while(br1 < p1 || br2 < p2){
if(br1 == p1){
mst[x].pb(mst[z][br2]);
br2++;
continue;
}
if(br2 == p2){
mst[x].pb(mst[y][br1]);
br1++;
continue;
}
if(mst[y][br1] < mst[z][br2])mst[x].pb(mst[y][br1++]);
else mst[x].pb(mst[z][br2++]);
}
}
void init(int node, int l, int r){
if(l == r){
seg[node] = niz[l];
mst[node].pb(niz[l]);
return;
}
int mid = (l + r) / 2;
init(node * 2, l, mid);
init(node * 2 + 1, mid + 1, r);
merg(node, node * 2, node * 2 + 1);
seg[node] = max(seg[node * 2], seg[node * 2 + 1]);
}
int query(int node, int l, int r, int levo, int desno, int targ){
}
int main()
{
ios_base::sync_with_stdio(false);
cin >> n >> m;
ff(i,1,n){
cin >> niz[i];
}
init(1,1,n);
ff(i,1,m){
int l,r,x;
cin >> l >> r >> x;
int sta = query(1,)
}
return 0;
}