# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
334316 | nandonathaniel | 돌 무게 재기 (IZhO11_stones) | C++14 | 74 ms | 5612 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
const int MAXN=100005;
int tree[2][4*MAXN],lazy[2][4*MAXN];
void updatenode(int no,int now,int L,int R,int val){
tree[no][now]+=val;
lazy[no][now]+=val;
}
void pushdown(int no,int now,int L,int R){
int mid=(L+R)/2;
updatenode(no,2*now,L,mid,lazy[no][now]);
updatenode(no,2*now+1,mid+1,R,lazy[no][now]);
lazy[no][now]=0;
}
int query(int no,int now,int L,int R,int x,int y){
if(L>=x && R<=y)return tree[no][now];
if(L>y || R<x)return 0;
pushdown(no,now,L,R);
int mid=(L+R)/2;
return max(query(no,2*now,L,mid,x,y),query(no,2*now+1,mid+1,R,x,y));
}
void update(int now,int L,int R,int x,int y,int val){
if(L>=x && R<=y){
updatenode(0,now,L,R,val);
updatenode(1,now,L,R,val);
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |