# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1095528 | epicci23 | Bubble Sort 2 (JOI18_bubblesort2) | C++17 | 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 "bubblesort2.h"
#include "bits/stdc++.h"
using namespace std;
struct SegT{
int n;
vector<int> seg,lazy;
SegT(int _n){
n=_n;
seg.assign(4*n+5,0);
lazy.assign(4*n+5,0);
}
void push(int rt,int l,int r){
int u=lazy[rt];
lazy[rt]=0;
seg[rt]+=u;
if(l==r) return;
lazy[rt*2]+=u;
lazy[rt*2+1]+=u;
}
void update(int rt,int l,int r,int gl,int gr,int u){
if(l>r || gl>gr || gr>=n) return;
push(rt,l,r);
if(r<gl || l>gr) return;
if(l>=gl && r<=gr){
lazy[rt]+=u;
push(rt,l,r);
return;
}