#include <bits/stdc++.h>
using namespace std;
long long a[101010],b[101010],c[101010];
long long ans[101010],cnt[101010];
long long n,mx;
int main () {
cin>>n;
for (int i=1;i<=n;i++){
cin>>a[i]>>b[i]>>c[i];
ans[i]=ans[i-1]+b[i];
cnt[i]=cnt[i-1]+c[i];
}
for (int i=1;i<=n;i++){
for (int j=i;j<=n;j++){
int q=a[j]-a[i];
int w=cnt[j]-cnt[i-1];
if (q<=w) mx=max(mx,ans[j]-ans[i-1]);
}
}
cout<<mx;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
2 ms |
384 KB |
Output is correct |
5 |
Correct |
2 ms |
384 KB |
Output is correct |
6 |
Correct |
2 ms |
384 KB |
Output is correct |
7 |
Correct |
3 ms |
300 KB |
Output is correct |
8 |
Correct |
2 ms |
384 KB |
Output is correct |
9 |
Correct |
2 ms |
384 KB |
Output is correct |
10 |
Correct |
2 ms |
384 KB |
Output is correct |
11 |
Correct |
0 ms |
384 KB |
Output is correct |
12 |
Correct |
2 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
9 ms |
384 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
3 ms |
384 KB |
Output is correct |
5 |
Correct |
3 ms |
384 KB |
Output is correct |
6 |
Incorrect |
9 ms |
384 KB |
Output isn't correct |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
25 ms |
572 KB |
Output is correct |
2 |
Correct |
97 ms |
772 KB |
Output is correct |
3 |
Incorrect |
73 ms |
780 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |