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 <iostream>
#include <iomanip>
#include <fstream>
#include <algorithm>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <cmath>
#include <list>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
const ll N = 2000004;
ll n, m, l, k, t, x, y,a[N],b[N],c[N];
int main()
{
cin >> n;
for (int i = 0; i < n; ++i)
{
cin >> a[i] >> b[i] >> c[i];
}
x = 0;
for (int i = 0; i < n; ++i)
{
for (int j = i; j < n; ++j)
{
x += b[j];
y += c[j];
if ((a[j] - a[i]) <= y)
m = max(m, x);
}
x = 0;
y = 0;
}
cout << m << endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |