제출 #741987

#제출 시각아이디문제언어결과실행 시간메모리
741987BidoTeima금 캐기 (IZhO14_divide)C++17
0 / 100
0 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() { 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; }

컴파일 시 표준 에러 (stderr) 메시지

divide.cpp: In function 'int main()':
divide.cpp:17:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |     freopen("divide.in", "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
divide.cpp:18:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |     freopen("divide.out", "w", stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...