Ellins @ 2024-07-31 19:38:23
#include<bits/stdc++.h>
using namespace std;
int main(){
cout<<"#include<bits/stdc++.h>\n";
cout<<"using namespace std;\n";
cout<<"int n,p,x,y,z,a[1000005];\n";
cout<<"int main(){\n";
cout<<" cin>>n>>p;\n";
cout<<" for(int i=1;i<=n;i++) cin>>a[i];\n";
cout<<" while(p--){\n";
cout<<" cin>>x>>y>>z;\n";
cout<<" for(int i=x;i<=y;i++){\n";
cout<<" a[i]+=z;\n";
cout<<" }\n";
cout<<" }\n";
cout<<" sort(a+1,a+1+n);\n";
cout<<" cout<<a[1];\n";
cout<<"}";
}
by quantum_MilkyWay @ 2024-07-31 19:43:26
@Ellins 数组开小了
by liyuan2023 @ 2024-07-31 20:04:20
@quantum_MilkyWay
开大数组会超时,要用线段树或差分,分块也行
by Lawrenceling @ 2024-08-02 18:27:33
@Ellins 数组太小,要开到5e6+10,另外建议用格式化输入/快读QwQ,祝早日AC。
by ZhengDanSAMA @ 2024-08-11 10:39:06
@Ellins
by goodsnack @ 2024-10-24 21:38:22
@Lawrence2011 感谢数据
by Lawrenceling @ 2024-10-25 20:32:18
@goodsnack ?什么东西