This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <string>
#include <functional>
#include <vector>
#include <deque>
#include <utility>
#include <bitset>
#include <limits.h>
#include <time.h>
using namespace std;
typedef long long ll;
typedef unsigned long long llu;
typedef double lf;
typedef unsigned int uint;
typedef long double llf;
typedef pair<int, int> pii;
const int N_ = 100005;
int N, X[N_], G[N_], D[N_];
ll SG[N_], SD[N_];
ll res;
int main() {
scanf("%d", &N);
for(int i = 1; i <= N; i++) scanf("%d%d%d", X+i, G+i, D+i);
for(int i = 1; i <= N; i++) SG[i] = SG[i-1]+G[i], SD[i] = SD[i-1]+D[i];
for(int i = 1; i <= N; i++) {
for(int j = i; j <= N; j++) {
int l = X[j] - X[i];
ll e = SD[j] - SD[i-1];
if(e >= l) res = max(res, SG[j] - SG[i-1]);
}
}
printf("%lld\n", res);
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... |