#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];
}
int l=1, r=1;
while(r<=n){
if(v[r]-v[l] <= b[r]-b[l-1])
mx=max(mx, a[r]-a[l-1]), r++;
else
l++;
// cout<<l<<' '<<r<<endl;
}
cout<<mx<<endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
400 KB |
Output is correct |
2 |
Correct |
3 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
348 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 |
420 KB |
Output is correct |
10 |
Correct |
2 ms |
376 KB |
Output is correct |
11 |
Correct |
2 ms |
376 KB |
Output is correct |
12 |
Correct |
2 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Incorrect |
3 ms |
376 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
632 KB |
Output is correct |
2 |
Correct |
14 ms |
760 KB |
Output is correct |
3 |
Correct |
18 ms |
760 KB |
Output is correct |
4 |
Correct |
86 ms |
2548 KB |
Output is correct |
5 |
Correct |
105 ms |
2736 KB |
Output is correct |
6 |
Correct |
223 ms |
5560 KB |
Output is correct |
7 |
Correct |
162 ms |
4316 KB |
Output is correct |
8 |
Correct |
158 ms |
4476 KB |
Output is correct |
9 |
Correct |
145 ms |
4344 KB |
Output is correct |
10 |
Incorrect |
163 ms |
4276 KB |
Output isn't correct |
11 |
Halted |
0 ms |
0 KB |
- |