# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
344585 | 2021-01-06T06:15:04 Z | bachaquer | Divide and conquer (IZhO14_divide) | C++14 | 1 ms | 364 KB |
#include <bits/stdc++.h> #define ll long long #define pb push_back using namespace std; ll n, x, g, d; struct lol { ll x; ll g; ll d; }; int main() { freopen("stdin", "r", stdin); freopen("stdout", "w", stdout); cin >> n; vector<lol> v; ll mx = 0; ll sum = 0; for (int i = 0; i < n; i++) { cin >> x >> g >> d; v.pb({x, g, d}); if (i == 0 || v[i - 1].d + v[i].d < (v[i].x - v[i - 1].x)) { sum = 0; } else { v[i - 1].d -= (v[i].x - v[i - 1].x); if (v[i - 1].d < 0) { v[i].d += v[i - 1].d; v[i - 1].d = 0; } } sum += v[i].g; if (sum > mx) mx = sum; } cout << mx; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 364 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 364 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 364 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |