제출 #601442

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
6014422022-07-21 22:31:36Bench0310휴가 (IOI14_holiday)C++17
100 / 100
1197 ms15688 KiB
#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]);
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...