# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
391944 | Jarif_Rahman | Index (COCI21_index) | C++17 | 1650 ms | 12288 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>
#define pb push_back
#define f first
#define sc second
using namespace std;
typedef long long int ll;
typedef string str;
const int sq = 417, lim = 524288;
bool mo(tuple<int, int, int> a, tuple<int, int, int> b){
return make_pair(get<0>(a)/sq, get<1>(a)) < make_pair(get<0>(b)/sq, get<1>(b));
}
struct segtree{
int k;
ll sm[lim];
segtree(int n){
k = lim;
}
void upd(int in, ll x){
in+=k/2;
sm[in] = x, in/=2;
while(in > 0){
sm[in] = sm[2*in] + sm[2*in+1];
in/=2;
}
}
inline ll sum(int l, int r, int nd, int a, int b){
if(b < l || a > r) return 0;
if(a >= l && b <= r) return sm[nd];
int c = (a+b)/2;
return sum(l, r, 2*nd, a, c) + sum(l, r, 2*nd+1, c+1, b);
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... |