이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
/** @BY_KUTBILIM **/
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define pb push_back
#define ll long long
int main(){
ios_base::sync_with_stdio(false);
cin.tie();
int n;
cin >> n;
ll x[n], g[n], d[n];
ll pg[n+1], pd[n+1];
pg[0] = pd[0] = 0;
for(int i = 0; i < n; i++){
cin >> x[i] >> g[i] >> d[i];
pg[i+1] = pg[i] + g[i];
pd[i+1] = pd[i] + d[i];
}
ll ans = 0;
for(int i = 1; i <= n; i++){
for(int j = 1; j <= i; j++){
if(pd[i] - pd[j-1] >= (x[i-1] - x[j-1]))ans = max(ans, pg[i] - pg[j-1]);
}
}
cout << ans;
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... |