제출 #741982

#제출 시각아이디문제언어결과실행 시간메모리
741982BidoTeima금 캐기 (IZhO14_divide)C++17
0 / 100
1 ms212 KiB
#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() { int n; cin>>n; set<pair<ll, ll>>st; ll gold = 0, energy = 0, ans = 0; for(int i = 0; i < n; i++){ int 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; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...