JamesZhan @ 2023-06-27 20:55:07
#include<iostream>
using namespace std;
int main(){
int n,q,op,l,r,x;
cin>>n>>q;
long long a[n+5],max=-999999999999999999;
for(int i=1;i<=n;i++){
cin>>a[i];
}
for(int i=0;i<q;i++){
cin>>op;
if(op==1){
cin>>l>>r>>x;
for(int j=l;j<=r;j++)a[j]=x;
}
if(op==2){
cin>>l>>r>>x;
for(int j=l;j<=r;j++)a[j]+=x;
}
if(op==3){
cin>>l>>r;
for(int j=l;j<=r;j++){
if(a[j]>max)max=a[j];
}
cout<<max<<endl;
max=-999999999999999999;
}
}
return 0;
}
by 07kzs @ 2023-06-27 20:58:41
@JamesZhan 正解是线段树/树状数组,暴力肯定超时啊
by LiJoQiao @ 2023-06-27 20:59:47
能到90分说明数据还是不强
by JamesZhan @ 2023-06-27 20:59:49
@07kzs 好吧,我还尝试卡时间过
by Accelessar @ 2023-07-02 10:31:05
卧槽,怎么暴力和分块一个分。