제출 #436968

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
4369682021-06-25 12:04:47haojiandan사탕 분배 (IOI21_candies)C++17
100 / 100
1258 ms32316 KiB
#include "candies.h"
#include <bits/stdc++.h>
using namespace std;
#define MP make_pair
typedef long long ll;
const ll INF=1e18;
const int maxn=(2e5)+10;
int n,q,c[maxn];
vector<pair<int,int> > Q[maxn];
ll mn[maxn*4],mx[maxn*4],lazy[maxn*4];
void puttag(int root,ll delta) {
lazy[root]+=delta,mn[root]+=delta,mx[root]+=delta;
}
void pushdown(int root) {
if (lazy[root]) {
puttag(root<<1,lazy[root]),puttag(root<<1|1,lazy[root]); lazy[root]=0;
}
}
void update(int L,int R,int l,int r,int root,ll delta) {
if (L<=l&&r<=R) { puttag(root,delta); return; }
int mid=(l+r)>>1; pushdown(root);
if (L<=mid) update(L,R,l,mid,root<<1,delta);
if (mid<R) update(L,R,mid+1,r,root<<1|1,delta);
mn[root]=min(mn[root<<1],mn[root<<1|1]);
mx[root]=max(mx[root<<1],mx[root<<1|1]);
}
pair<ll,ll> operator + (pair<ll,ll> t1,pair<ll,ll> t2) { return MP(min(t1.first,t2.first),max(t1.second,t2.second)); }
pair<ll,ll> query(int L,int R,int l,int r,int root) {
if (L<=l&&r<=R) return MP(mn[root],mx[root]);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
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...
#Verdict Execution timeMemoryGrader output
Fetching results...