이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
# 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], b[N], c[N];
ll ans;
int main()
{
cin >> n;
for(int i = 1; i <= n; i ++)
cin >> a[i] >> b[i] >> c[i];
for(int i = 1; i <= n; i ++)
{
for(int j = i; j <= n; j ++)
{
ll res = 0, sum = 0;
for(int k = i; k <= j; k ++)
sum += c[k], res += b[k];
if(sum < (a[j] - a[i])) continue;
ans = max(ans, res);
}
}
cout << ans << endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |