# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
751302 | sofija6 | Index (COCI21_index) | C++14 | 391 ms | 95448 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 ll long long
#define MAXN 200010
#define MAXV 2000010
using namespace std;
ll p[MAXN],root[MAXV],l[MAXV],r[MAXV],val[MAXV],ind=1;
void Init(ll node,ll lx,ll rx)
{
if (lx==rx)
return;
l[node]=ind++;
r[node]=ind++;
ll mid=(lx+rx)/2;
Init(l[node],lx,mid);
Init(r[node],mid+1,rx);
}
void Update(ll node,ll pnode,ll lx,ll rx,ll pos,ll vall)
{
if (lx==rx)
{
val[node]=val[pnode]+vall;
return;
}
ll mid=(lx+rx)/2;
if (pos<=mid)
{
l[node]=ind++;
r[node]=r[pnode];
Update(l[node],l[pnode],lx,mid,pos,vall);
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |