Submission #561502

#TimeUsernameProblemLanguageResultExecution timeMemory
561502gg123_peDivide and conquer (IZhO14_divide)C++14
48 / 100
1090 ms3252 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define f(i,a,b) for(int i = a; i < b; i++) const int N = 1e5 + 5; int n; ll a[N], g[N], e[N], sg[N], se[N], ans; int main(){ cin >> n; f(i,1,n+1) { cin >> a[i] >> g[i] >> e[i]; sg[i] = sg[i-1] + g[i]; se[i] = se[i-1] + e[i]; } f(i,1,n+1){ f(j,i,n+1){ if(se[j]-se[i-1] >= a[j]-a[i]){ ans = max(ans, sg[j]-sg[i-1]); } } } cout << ans << "\n"; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...