Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
Register

## CE了？？？

Posted by 455675787 at 2018-08-06 21:39:27 on Problem 3468
```//AC：https://www.luogu.org/recordnew/show/9383116
//No bits/stdc++.h
code:
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<queue>
#include<stack>
#define ll long long
using namespace std;

const ll INF=2147483647;

ll a[100010],n,m;
struct Segmet_Tree{
}Tree[100010*4];

void build(ll p,ll l,ll r){
Tree[p].l=l; Tree[p].r=r;
if(l==r){
Tree[p].sum=a[l];
return;
}
ll mid=(l+r)/2;
build(p*2,l,mid);
build(p*2+1,mid+1,r);
Tree[p].sum=Tree[p*2].sum+Tree[p*2+1].sum;
}

}
}

void change(ll p,ll l,ll r,ll d){
if(l<=Tree[p].l&&r>=Tree[p].r){
Tree[p].sum+=(ll)d*(Tree[p].r-Tree[p].l+1);
return;
}
ll mid=(Tree[p].l+Tree[p].r)/2;
if(l<=mid) change(p*2,l,r,d);
if(r>mid) change(p*2+1,l,r,d);
Tree[p].sum=Tree[p*2].sum+Tree[p*2+1].sum;
}

ll query(ll p,ll l,ll r){
if(l<=Tree[p].l&&r>=Tree[p].r) return Tree[p].sum;
ll mid=(Tree[p].l+Tree[p].r)/2,ans=0;
if(l<=mid) ans+=query(p*2,l,r);
if(r>mid) ans+=query(p*2+1,l,r);
return ans;
}

ll tmp=1,x=0;
char ch=getchar();
while(!isdigit(ch)){
if(ch=='-') tmp=-1;
ch=getchar();
}

while(isdigit(ch)){
x=x*10+ch-48;
ch=getchar();
}
return tmp*x;
}

inline void write(ll x){
ll y=10,len=1;
while(y<=x){
y*=10;
len++;
}
while(len--){
y/=10;
putchar(x/y+48);
x%=y;
}
}

int main(){
for(ll i=1; i<=n; i++){
}

build(1,1,n);

while(m--){
string pd;
cin>>pd;
if(pd=="C"){
change(1,x,y,k);
}
else{
write(query(1,x,y));
putchar('\n');
}
}
}```

Followed by: