이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define fr first
#define sc second
#define OK puts("OK");
#define pb push_back
#define mk make_pair
using namespace std;
typedef long long ll;
const int inf = (int)1e9 + 7;
const int N = (int)1e5 + 7;
int n;
int x[N],g[N],d[N];
ll p[N],res[N],mx;
int main () {
cin >> n;
for (int i = 1; i <= n; i ++) {
cin >> x[i] >> g[i] >> d[i];
p[i] = p[i - 1] + d[i];
res[i] = res[i - 1] + g[i];
}
for (int i = 1; i <= n; i ++) {
for (int j = i; j <= n; j ++) {
ll o = p[j] - p[i - 1];
ll len = (x[j] - x[i]);
ll ans = (res[j] - res[i - 1]);
if (o >= len)
mx = max(mx,ans);
}
}
cout << mx << 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... |