/*
/\ /\
| ).|.( |
| >-< |
=========
It's AdilkhanKo miaaaaaau
*/
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define endl "\n"
#define foreach(it, S) for(__typeof (S.begin()) it = S.begin(); it != S.end(); it++)
#define mp make_pair
#define f first
#define s second
#define name ""
#define _ ios_base::sync_with_stdio(false);cin.tie(0);
using namespace std;
const int MaxN = int (2e5) + 256;
const int INF = int(1e9);
const int mod = (int)(1e9) + 7;
long long n, a[MaxN], m, t, x[MaxN], g[MaxN], d[MaxN], D[MaxN], G[MaxN];
int main () { _
/* #ifdef ONLINE_JUDGE
freopen (name".in","r",stdin);
freopen (name".out","w",stdout);
#else
freopen (".in","r",stdin);
freopen (".out","w",stdout);
#endif*/
cin >> n;
for(int i = 1; i <= n; i++){
cin >> x[i] >> g[i] >> d[i];
D[i] = D[i - 1] + d[i];
G[i] = G[i - 1] + g[i];
}
int l = 1, r = 1;
ll ans = 0, cnt = 0;
for(int i = 1; i <= n; i++){
for(int j = 1; j <= i; j++){
if(x[i] - x[j] <= D[i] - D[j - 1]){
ans = max(ans, G[i] - G[j - 1]);
break;
}
}
}
cout << ans;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
11096 KB |
Output is correct |
2 |
Correct |
0 ms |
11096 KB |
Output is correct |
3 |
Correct |
0 ms |
11096 KB |
Output is correct |
4 |
Correct |
0 ms |
11096 KB |
Output is correct |
5 |
Correct |
0 ms |
11096 KB |
Output is correct |
6 |
Correct |
0 ms |
11096 KB |
Output is correct |
7 |
Correct |
0 ms |
11096 KB |
Output is correct |
8 |
Correct |
0 ms |
11096 KB |
Output is correct |
9 |
Correct |
0 ms |
11096 KB |
Output is correct |
10 |
Correct |
0 ms |
11096 KB |
Output is correct |
11 |
Correct |
0 ms |
11096 KB |
Output is correct |
12 |
Correct |
0 ms |
11096 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
11096 KB |
Output is correct |
2 |
Correct |
0 ms |
11096 KB |
Output is correct |
3 |
Correct |
0 ms |
11096 KB |
Output is correct |
4 |
Correct |
0 ms |
11096 KB |
Output is correct |
5 |
Correct |
2 ms |
11096 KB |
Output is correct |
6 |
Correct |
0 ms |
11096 KB |
Output is correct |
7 |
Correct |
0 ms |
11096 KB |
Output is correct |
8 |
Correct |
0 ms |
11096 KB |
Output is correct |
9 |
Correct |
0 ms |
11096 KB |
Output is correct |
10 |
Correct |
0 ms |
11096 KB |
Output is correct |
11 |
Correct |
21 ms |
11096 KB |
Output is correct |
12 |
Correct |
20 ms |
11096 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
11096 KB |
Output is correct |
2 |
Correct |
3 ms |
11096 KB |
Output is correct |
3 |
Correct |
3 ms |
11096 KB |
Output is correct |
4 |
Correct |
21 ms |
11096 KB |
Output is correct |
5 |
Correct |
21 ms |
11096 KB |
Output is correct |
6 |
Correct |
34 ms |
11096 KB |
Output is correct |
7 |
Correct |
29 ms |
11096 KB |
Output is correct |
8 |
Correct |
29 ms |
11096 KB |
Output is correct |
9 |
Correct |
18 ms |
11096 KB |
Output is correct |
10 |
Execution timed out |
1000 ms |
11096 KB |
Program timed out |
11 |
Halted |
0 ms |
0 KB |
- |