# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
774837 | giaminh2211 | Addk (eJOI21_addk) | C++14 | 296 ms | 8780 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 IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define int long long
const int NM = 1e6 + 5;
int n, k, q, a[NM], q1[15], tree1[NM<<2], tree2[NM<<2], tree3[NM<<2];
void build1(int *arr, int id = 1, int l = 1, int r = n) {
if (l == r) {
tree1[id] = arr[l];
return;
}
int mid = (l+r) >> 1;
build1(arr, id<<1, l, mid);
build1(arr, id<<1|1, mid+1, r);
tree1[id] = tree1[id<<1] + tree1[id<<1|1];
}
void build2(int *arr, int id = 1, int l = 1, int r = n) {
if (l == r) {
tree2[id] = arr[l] * l;
return;
}
int mid = (l+r) >> 1;
build2(arr, id<<1, l, mid);
build2(arr, id<<1|1, mid+1, r);
tree2[id] = tree2[id<<1] + tree2[id<<1|1];
}
void build3(int *arr, int id = 1, int l = 1, int r = n) {
if (l == r) {
tree3[id] = arr[l] * (n-l+1);
return;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |