# include <bits/stdc++.h>
# define pb push_back
# define fr first
# define sc second
# define mk make_pair
using namespace std;
const int inf = 1e9 + 7;
const int N = 1e6 + 5;
typedef long long ll;
int n, a[N];
ll ans, b[N], c[N];
int main()
{
cin >> n;
for(int i = 1; i <= n; i ++)
{
cin >> a[i] >> b[i] >> c[i];
b[i] += b[i - 1];
c[i] += c[i - 1];
}
for(int i = 1; i <= n; i ++)
{
for(int j = 1; j <= i; j ++)
{
ll res = b[i] - b[j - 1], sum = c[i] - c[j - 1];
if(sum < a[i] - a[j]) continue;
ans = max(ans, res);
break;
}
}
cout << ans << endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
21548 KB |
Output is correct |
2 |
Correct |
0 ms |
21548 KB |
Output is correct |
3 |
Correct |
0 ms |
21548 KB |
Output is correct |
4 |
Correct |
0 ms |
21548 KB |
Output is correct |
5 |
Correct |
0 ms |
21548 KB |
Output is correct |
6 |
Correct |
0 ms |
21548 KB |
Output is correct |
7 |
Correct |
0 ms |
21548 KB |
Output is correct |
8 |
Correct |
0 ms |
21548 KB |
Output is correct |
9 |
Correct |
0 ms |
21548 KB |
Output is correct |
10 |
Correct |
0 ms |
21548 KB |
Output is correct |
11 |
Correct |
0 ms |
21548 KB |
Output is correct |
12 |
Correct |
0 ms |
21548 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
21548 KB |
Output is correct |
2 |
Correct |
0 ms |
21548 KB |
Output is correct |
3 |
Correct |
0 ms |
21548 KB |
Output is correct |
4 |
Correct |
0 ms |
21548 KB |
Output is correct |
5 |
Correct |
0 ms |
21548 KB |
Output is correct |
6 |
Correct |
3 ms |
21548 KB |
Output is correct |
7 |
Correct |
0 ms |
21548 KB |
Output is correct |
8 |
Correct |
0 ms |
21548 KB |
Output is correct |
9 |
Correct |
0 ms |
21548 KB |
Output is correct |
10 |
Correct |
3 ms |
21548 KB |
Output is correct |
11 |
Correct |
23 ms |
21548 KB |
Output is correct |
12 |
Correct |
23 ms |
21548 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
21548 KB |
Output is correct |
2 |
Correct |
6 ms |
21548 KB |
Output is correct |
3 |
Correct |
13 ms |
21548 KB |
Output is correct |
4 |
Correct |
59 ms |
21548 KB |
Output is correct |
5 |
Correct |
76 ms |
21548 KB |
Output is correct |
6 |
Correct |
166 ms |
21548 KB |
Output is correct |
7 |
Correct |
133 ms |
21548 KB |
Output is correct |
8 |
Correct |
116 ms |
21548 KB |
Output is correct |
9 |
Correct |
99 ms |
21548 KB |
Output is correct |
10 |
Execution timed out |
1000 ms |
21548 KB |
Execution timed out |
11 |
Halted |
0 ms |
0 KB |
- |