제출 #719110

#제출 시각아이디문제언어결과실행 시간메모리
719110fdnfksd금 캐기 (IZhO14_divide)C++14
48 / 100
1083 ms2512 KiB
#include<bits/stdc++.h> #define TASKNAME "codeforce" #define pb push_back #define pli pair<int,int> #define fi first #define se second #define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); using namespace std; using ll=long long; const ll maxN=2e5; const ll inf=1e18; const ll mod=1e9+7; ll ans=-inf; ll n,x[maxN],g[maxN],d[maxN]; void solve() { cin >> n; for(int i=1;i<=n;i++) cin >> x[i] >> g[i] >> d[i]; for(int i=1;i<=n;i++) { ll sum=g[i],re=d[i]; ans=max(ans,sum); for(int j=i+1;j<=n;j++) { re+=d[j]; sum+=g[j]; if(re>=x[j]-x[i]) ans=max(ans,sum); } } cout << ans; } int main() { fastio //freopen(TASKNAME".INP","r",stdin); //freopen(TASKNAME".OUT","w",stdout); solve(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...