# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1114220 | farica | Bubble Sort 2 (JOI18_bubblesort2) | C++14 | 26 ms | 2896 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>
using namespace std;
using vi = vector<int>;
vi a, segm, lazy;
vector<pair<int,int>>V;
void propagate(int pos, int l, int r) {
if(l==r) return;
int m = (l+r)/2, right = pos + 2 * (m-l+1);
lazy[pos+1] += lazy[pos];
lazy[right] += lazy[pos];
segm[pos+1] += lazy[pos];
segm[right] += lazy[pos];
lazy[pos] = 0;
}
void upd(int pos, int l, int r, int L, int R, int val) {
if(l > R or r < L) return;
propagate(pos, l, r);
if(l >= L && r <= R) {
segm[pos] += val;
lazy[pos] += val;
return;
}
int m = (l+r)/2, right = pos + 2 * (m-l+1);
if(L <= m) upd(pos+1, l, m, L, R, val);
if(R >= m+1) upd(right, m+1, r, L, R, val);
segm[pos] = max(segm[pos+1], segm[right]);
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |