Submission #890415

#TimeUsernameProblemLanguageResultExecution timeMemory
890415vjudge1금 캐기 (IZhO14_divide)C++17
48 / 100
1051 ms1624 KiB
#include <bits/stdc++.h> using namespace std; //#pragma comment(linker, "/stack:2000000000") //#pragma GCC optimize("Ofast,unroll-loops,fast-math,O3") //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native") #define x first #define y second #define ll long long #define ull unsigned long long #define ld long double #define pb push_back #define mp make_pair #define all(v) v.begin(), v.end() void boost(){ ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0); return; } void solve(){ int n; cin>>n; pair<int,pair<int,int>>a[n+1]; ll prefg[n+1],prefd[n+1]; prefg[0]=0,prefd[0]=0; for(int i=1; i<=n; i++){ int p,g,d; cin>>p>>g>>d; a[i]=mp(p,mp(g,d)); prefg[i]=prefg[i-1]+g; prefd[i]=prefd[i-1]+d; } a[0]=mp(a[1].x,mp(0,0)); ll ans=0; for(int i=1; i<=n; i++){ for(int j=i; j<=n; j++){ if(prefd[j]-prefd[i-1]>=a[j].x-a[i].x) ans=max(ans,prefg[j]-prefg[i-1]); } } cout<<ans; return; } int main(){ boost(); int t=1; // cin>>t; while(t--) solve(); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...