# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
104971 | Aydarov03 | Divide and conquer (IZhO14_divide) | C++14 | 1065 ms | 2552 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define int long long
using namespace std;
int x[100005];
int g[100005];
int e[100005];
main()
{
int n , ans = 0;
cin >> n;
for(int i = 1; i <= n; i++)
{
cin >> x[i] >> g[i] >> e[i];
}
int gold = 0 , energy = 0;
for(int i = 1; i <= n; i++)
{
gold = 0 , energy = 0;
for(int j = i; j <= n; j++)
{
gold += g[j];
energy += e[j];
if(x[j] - x[i] <= energy)
{
ans = max(ans , gold);
}
}
}
cout << ans << endl;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |