Submission #990138

#TimeUsernameProblemLanguageResultExecution timeMemory
990138tch1cherinDivide and conquer (IZhO14_divide)C++17
48 / 100
1024 ms1936 KiB
#include <bits/stdc++.h> using namespace std; int main() { cin.tie(nullptr)->sync_with_stdio(false); int N; cin >> N; vector<int> x(N), g(N), d(N); for (int i = 0; i < N; i++) { cin >> x[i] >> g[i] >> d[i]; } long long answer = 0; for (int i = 0; i < N; i++) { long long sum_g = 0, sum_d = 0; for (int j = i; j < N; j++) { sum_g += g[j]; sum_d += d[j]; if (sum_d >= x[j] - x[i]) { answer = max(answer, sum_g); } } } cout << answer << "\n"; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...