# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1167565 | fryingduc | Addk (eJOI21_addk) | C++20 | 372 ms | 6432 KiB |
#include "bits/stdc++.h"
using namespace std;
#ifdef duc_debug
#include "bits/debug.h"
#else
#define debug(...)
#endif
const int maxn = 1e5 + 5;
int n, k, a[maxn];
long long tree[maxn << 2];
long long lazy[maxn << 2];
void down(int ind, int l = 1, int r = n) {
tree[ind] += lazy[ind] * (r - l + 1);
if (l != r) {
lazy[ind << 1] += lazy[ind];
lazy[ind << 1 | 1] += lazy[ind];
}
lazy[ind] = 0;
}
void update(int x, int y, int val, int ind = 1, int l = 1, int r = n) {
if (lazy[ind]) down(ind, l, r);
if (x > y || l > y || r < x) return;
if (x <= l and r <= y) {
lazy[ind] = val;
down(ind, l, r);
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |