#include <bits/stdc++.h>
#define N 100009
#define pii pair <int, int>
#define ff first
#define ss second
#define pb push_back
#define ll long long
using namespace std;
ll n, v[N], mx, a[N], b[N];
int main(){
cin>>n;
for(int i=1; i<=n; i++){
cin>>v[i]>>a[i]>>b[i];
a[i]+=a[i-1], b[i]+=b[i-1];
}
for(int i=1; i<=n; i++){
for(int j=i; j<=n; j++){
if(v[j]-v[i]<=b[j]-b[i-1])
mx=max(mx, a[j]-a[i-1]);
// else
// break;
}
}
cout<<mx<<endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
3 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
7 |
Correct |
2 ms |
376 KB |
Output is correct |
8 |
Correct |
2 ms |
376 KB |
Output is correct |
9 |
Correct |
2 ms |
376 KB |
Output is correct |
10 |
Correct |
2 ms |
376 KB |
Output is correct |
11 |
Correct |
2 ms |
376 KB |
Output is correct |
12 |
Correct |
3 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
248 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
3 ms |
376 KB |
Output is correct |
4 |
Correct |
4 ms |
376 KB |
Output is correct |
5 |
Correct |
4 ms |
376 KB |
Output is correct |
6 |
Correct |
7 ms |
376 KB |
Output is correct |
7 |
Correct |
4 ms |
376 KB |
Output is correct |
8 |
Correct |
4 ms |
376 KB |
Output is correct |
9 |
Correct |
5 ms |
376 KB |
Output is correct |
10 |
Correct |
7 ms |
376 KB |
Output is correct |
11 |
Correct |
22 ms |
504 KB |
Output is correct |
12 |
Correct |
22 ms |
504 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
24 ms |
376 KB |
Output is correct |
2 |
Correct |
81 ms |
632 KB |
Output is correct |
3 |
Correct |
86 ms |
616 KB |
Output is correct |
4 |
Execution timed out |
1065 ms |
1532 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |