#include <bits/stdc++.h>
#define pb push_back
#define ss second
#define ff first
#define N 100005
#define inf 1000000009
#define ll long long
#define mid(a,b) (a+b)/2
using namespace std;
int n;
ll x[N],g,e;
ll dis[N],gold[N],jog,mx;
int main()
{
cin >> n;
for(int i = 1;i <= n;i++){
cin >> x[i] >> g >> e;
gold[i] = gold[i - 1] + g;
dis[i] = dis[i - 1] + e;
for(int j = 1;j <= i;j++){
if(x[i] - x[j] <= dis[i] - dis[j - 1]){
jog = gold[i] - gold[j - 1];
break;
}
}
mx = max(jog,mx);
}
cout << mx;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
248 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 |
2 ms |
376 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 |
Correct |
3 ms |
376 KB |
Output is correct |
4 |
Correct |
3 ms |
376 KB |
Output is correct |
5 |
Correct |
4 ms |
376 KB |
Output is correct |
6 |
Correct |
5 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 |
6 ms |
380 KB |
Output is correct |
10 |
Correct |
7 ms |
376 KB |
Output is correct |
11 |
Correct |
26 ms |
576 KB |
Output is correct |
12 |
Correct |
27 ms |
632 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
504 KB |
Output is correct |
2 |
Correct |
13 ms |
632 KB |
Output is correct |
3 |
Correct |
18 ms |
768 KB |
Output is correct |
4 |
Correct |
85 ms |
2580 KB |
Output is correct |
5 |
Correct |
102 ms |
2552 KB |
Output is correct |
6 |
Correct |
219 ms |
5240 KB |
Output is correct |
7 |
Correct |
150 ms |
4344 KB |
Output is correct |
8 |
Correct |
165 ms |
4476 KB |
Output is correct |
9 |
Correct |
144 ms |
4220 KB |
Output is correct |
10 |
Execution timed out |
1078 ms |
2292 KB |
Time limit exceeded |
11 |
Halted |
0 ms |
0 KB |
- |