제출 #530532

#제출 시각아이디문제언어결과실행 시간메모리
530532peuchHotel (CEOI11_hot)C++17
0 / 100
442 ms14560 KiB
#include<bits/stdc++.h> using namespace std; const int MAXN = 5e5 + 10; int n, m, o; pair<int, int> v[MAXN]; pair<int, int> p[MAXN]; vector<long long> moedas; int main(){ scanf("%d %d %d", &n, &m, &o); for(int i = 1; i <= n; i++) scanf("%d %d", &v[i].second, &v[i].first); for(int i = 1; i <= m; i++) scanf("%d %d", &p[i].second, &p[i].first); sort(v + 1, v + 1 + n); sort(p + 1, p + 1 + m); int id = 1; multiset<int> s; for(int i = 1; i <= n; i++){ while(id <= m && p[id].first <= v[i].first){ s.insert(p[id].second); id++; } if(!s.empty()){ moedas.push_back((*s.begin()) + v[i].second); s.erase(s.begin()); } } long long ans = 0; long long sum = 0; sort(moedas.begin(), moedas.end()); for(int i = 0; i < min(o, (int) moedas.size()); i++){ sum -= moedas[i]; ans = max(ans, sum); } printf("%lld\n", ans); }

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

hot.cpp: In function 'int main()':
hot.cpp:12:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |   scanf("%d %d %d", &n, &m, &o);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
hot.cpp:14:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |     scanf("%d %d", &v[i].second, &v[i].first);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
hot.cpp:16:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |     scanf("%d %d", &p[i].second, &p[i].first);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...