midsummer_zyl @ 2023-08-12 21:27:07
#include <bits/stdc++.h>
using namespace std;
const int N = 1e6;
int a[N];
int main() {
int n, p, x, y, z;
cin >> n >> p;
for (int i = 1; i <= n; i++)
cin >> a[i];
for (int i = 1; i <= p; i++) {
cin >> x >> y >> z;
for (int i = x; i <= y; i++)
a[i] += z;
}
sort(a + 1, a + n + 1, less<int>());
cout << a[1];
return 0;
}
求助大佬!
by rnf5114 @ 2023-08-12 21:29:54
@midsummer_zyl const int N = 5e6+10;改成
by rnf5114 @ 2023-08-12 21:30:46
@midsummer_zyl 还有暴力别指望过
by midsummer_zyl @ 2023-08-13 20:59:53
@rnfmabj5114
可还是80分!
by rnf5114 @ 2023-08-13 21:18:35
@midsummer_zyl 你这是暴力啊
by PanHOVER @ 2023-09-18 19:36:26
但你最坏时间复杂度是n的平方啊