Submission #1087053

#TimeUsernameProblemLanguageResultExecution timeMemory
1087053MuhammetDivide and conquer (IZhO14_divide)C++17
48 / 100
1048 ms2396 KiB
#include <bits/stdc++.h> using namespace std; #define int long long signed main(){ int n; cin >> n; vector <int> a(n), g(n), e(n); for(int i = 0; i < n; i++){ cin >> a[i] >> g[i] >> e[i]; } for(int i = 1; i < n; i++){ g[i] += g[i-1]; e[i] += e[i-1]; } int ans = 0; for(int i = 0; i < n; i++){ for(int j = i; j < n; j++){ int x = (e[j] - (i == 0 ? 0 : e[i-1])); if(x >= (a[j]-a[i])){ ans = max(ans,(g[j] - (i == 0 ? 0 : g[i-1]))); } } } cout << ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...