Submission #1087052

#TimeUsernameProblemLanguageResultExecution timeMemory
1087052MuhammetDivide and conquer (IZhO14_divide)C++17
17 / 100
1 ms516 KiB
#include <bits/stdc++.h> using namespace std; int 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...