tianyun4188awa @ 2024-12-21 23:34:47
#include <bits/stdc++.h>
using namespace std;
const int N = 5e6 + 5;
int a[N];
int minn;
int main() {
int n, p;
cin >> n >> p;
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
while (p--) {
int x, y, z;
cin >> x >> y >> z;
for (int i = x; i <= y; i++) {
a[i] += z;
}
}
minn = INT_MAX;
for (int i = 1; i <= n; i++) {
minn = min(minn, a[i]);
}
cout << minn;
return 0;
}
啊啊啊
by Zheng_iii @ 2024-12-21 23:52:55
得用差分吧