# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
741987 | 2023-05-15T09:44:21 Z | BidoTeima | Divide and conquer (IZhO14_divide) | C++17 | 0 ms | 212 KB |
#include <iostream> #include <cstdio> #include <vector> #include <algorithm> #include <set> #include <cmath> #include <fstream> #include <string> #include <random> #include <chrono> #include <memory.h> using namespace std; using ll = long long; int main() { freopen("divide.in", "r", stdin); freopen("divide.out", "w", stdout); int n; cin>>n; set<pair<ll, ll>>st; ll gold = 0, energy = 0, ans = 0; for(int i = 0; i < n; i++){ ll x,g,d; cin>>x>>g>>d; st.insert(make_pair(x - energy, gold)); gold += g, energy += d; auto it = st.lower_bound(make_pair(x - energy, 0ll)); if(it != st.end()){ ans = max(ans, gold - it->second); } } cout<<ans<<'\n'; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |