AIchenjunan @ 2024-12-15 15:15:34
#include <bits/stdc++.h>
using namespace std;
int n,m,a[1000005];
int main() {
cin>>n>>m;
for(int i=1; i<=n; i++) {
cin>>a[i];
}
while(m--){
int aa,bb,cc;
cin>>aa>>bb>>cc;
for(int i=aa;i<=bb;i++){
a[i]+=cc;
}
}
sort(a+1,a+n+1);
cout<<a[1];
return 0;
}
最后一个测试点没过
by AIchenjunan @ 2024-12-15 15:17:26
在线等,急。
by Rigil_Kent @ 2024-12-15 15:20:38
您这个做法是
by oldhorse1989 @ 2024-12-15 15:20:48
暴力会超时
用差分
by AIchenjunan @ 2024-12-15 15:24:52
@Rigil_Kent,@oldhorse1989谢谢,已关