# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
543660 | tudor | Addk (eJOI21_addk) | C++17 | 379 ms | 7560 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 <iostream>
using namespace std;
const int nmax = 1e5;
const int kmax = 10;
int n;
long long aib[2][nmax + 1];
/// query ( aib[0], n ) -> suma v[i], 1 <= i <= n
/// query ( aib[1], n ) -> suma v[i] * i, 1 <= i <= n
void update ( int p, int poz, long long add ) {
for ( ; poz <= n; poz += poz & -poz )
aib[p][poz] += add;
}
long long query ( int p, int poz ) {
long long s = 0;
for ( ; poz > 0; poz -= poz & -poz )
s += aib[p][poz];
return s;
}
long long sum ( int p, int a, int b ) {
return query ( p, b ) - query ( p, a - 1 );
}
int v[nmax + 1];
int ind[kmax + 1];
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |