# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
741987 | 2023-05-15T09:44:21 Z | BidoTeima | 금 캐기 (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
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |