题目描述
blablabla
样例
# include<iostream>
using namespace std;
const int N = 1010;
int n, s[N], t[N], tong[N], d[N], sum[N];
int maxn;
int main()
{
cin >> n;
for (int i = 1; i <= n; i ++) cin >> s[i] >> t[i] >> tong[i];
for (int i = 1; i <= n; i ++)
{
d[s[i]] += tong[i];
d[t[i] + 1] -= tong[i];
}
for (int i = 1; i <= N; i ++) sum[i] = sum[i - 1] + d[i];
for (int i = 1; i <= N; i ++) maxn = max(maxn, sum[i]);
cout << maxn;
return 0;
}
算法1
(暴力枚举) $O(n^2)$
blablabla
时间复杂度
参考文献
C++ 代码
blablabla
算法2
(暴力枚举) $O(n^2)$
blablabla
时间复杂度
参考文献
C++ 代码
blablabla