zrx0204 @ 2024-10-20 15:58:50
~~~
#include<bits/stdc++.h>
using namespace std;
int n, p, sum;
int a[100005];
bool cmp(int a, int s){
return abs(a) < abs(s);
}
int main(){
cin >> n >> p;
for(int i = 1; i <= n; i++) cin >> a[i];
for(int i = 1; i <= p; i++){
int x, y, z;
cin >> x >> y >> z;
for(int j = x; j <= y; j++) a[j] += z;
}
sort(a + 1, a + 1 + n, cmp);
cout << a[1];
return 0;
}
by _lxc__ @ 2024-10-20 16:03:15
数组开小了+超时(应该用差分解决
by zrx0204 @ 2024-10-20 16:06:50
@_lxc___ 可是评测结果是WA不是超时啊
by zrx0204 @ 2024-10-20 16:07:42
@_lxc___ 改完数组大小还是WA了一个
by geyuzhen @ 2024-10-20 16:08:39
下载一下不久行了马
by qinshi0308 @ 2024-10-20 16:10:19
这不是线段树板子吗
by snowball10185 @ 2024-11-01 16:15:55
开5000001
by snowball10185 @ 2024-11-01 16:17:05
不要abs
取min就行了
by snowball10185 @ 2024-11-01 16:17:35
@zrx0204
by zrx0204 @ 2024-11-01 19:14:22
@snowball10185 还是80
by snowball10185 @ 2024-11-01 22:09:21
@zrx0204
十年OI一场空,不开long long 见祖宗
上long long试试试试就逝世