# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
601442 | Bench0310 | Holiday (IOI14_holiday) | C++17 | 1197 ms | 15688 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>
#include "holiday.h"
using namespace std;
typedef long long ll;
const int N=200005;
ll tree[4*N];
int cnt[4*N];
void update(int idx,int l,int r,int pos,ll dt,int dc)
{
tree[idx]+=dt;
cnt[idx]+=dc;
if(l<r)
{
int m=(l+r)/2;
if(pos<=m) update(2*idx,l,m,pos,dt,dc);
else update(2*idx+1,m+1,r,pos,dt,dc);
}
}
ll descend(int idx,int l,int r,int c)
{
if(c>=cnt[idx]) return tree[idx];
if(c<=0) return 0;
int m=(l+r)/2;
return descend(2*idx+1,m+1,r,c)+descend(2*idx,l,m,c-cnt[2*idx+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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |