이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define nl "\n"
#define bananas return 0;
#define ll long long
#define IOS ios_base :: sync_with_stdio(NULL); cin.tie(0); cout.tie(0);
const int N=2e5+6;
const int INF=1e9+6;
int main() {
IOS
ll n;
cin>>n;
int x[n+1],g[n+1],e[n+1];
for (int i=1;i<=n;i++) {
cin>>x[i]>>g[i]>>e[i];
}
ll mx=-1;
for(int i=1;i<=n;i++) {
ll energy=0;
ll point=0;
ll gold=0;
for (int j=i;j<=n;j++) {
energy+=e[j];
point=x[j]-x[i];
if (energy>=point) {
gold+=g[j];
mx=max(gold,mx);
}else {
break;
}
}
}
cout<<mx;
bananas
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |