# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
564474 | keta_tsimakuridze | Election (BOI18_election) | C++14 | 901 ms | 49808 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;
//#define int long long
#define pii pair<int,int>
#define f first
#define s second
#define endl "\n"
const int N = 5e5 + 5, mod = 1e9 + 7; //!
int t[N], t2[N], p[N], tree[4 * N], lazy[4 * N], ans[N];
vector<pair<int,int> > x[N];
void push(int u ,int l,int r) {
tree[u] += lazy[u];
if(l != r) lazy[2 * u] += lazy[u], lazy[2 * u + 1] += lazy[u];
lazy[u] = 0;
return;
}
void upd(int u, int st, int en, int l,int r,int v) {
if(lazy[u]) push(u, l, r);
if(l > en || r < st) return;
if(st <= l && r <= en) {
lazy[u] = v;
push(u, l, r);
return;
}
int mid = (l + r) / 2;
upd(2 * u, st, en, l, mid, v); upd(2 * u + 1, st, en, mid + 1, r, v);
tree[u] = max(tree[2 * u], tree[2 * u + 1]);
}
int get(int u, int st,int en, int l,int r) {
if(lazy[u]) push(u, l, r);
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |