Submission #739937

# Submission time Handle Problem Language Result Execution time Memory
739937 2023-05-11T17:18:54 Z Unforgettablepl Hotel (CEOI11_hot) C++17
Compilation error
0 ms 0 KB
/*
ID: samikgo1
TASK:
LANG: C++
*/
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
typedef pair<ll,ll> pll;
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
//#define f first
//#define s second
//#define x first
//#define y second
const int INF = INT32_MAX;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
//    freopen("measurement.in","r",stdin);
//    freopen("measurement.out","w",stdout);
    ll n,m,o;
    cin >> n >> m >> o;
    vector<pll> rooms(n);
    vector<pll> offers(m);
    for(pll&i:rooms)cin>>i.second>>i.first;
    for(pll&i:offers)cin>>i.first>>i.second;
    set<pll> roomss(all(rooms));
    sort(allr(offers));
    vector<ll> ans;
    for (pll &i: offers) {
        // i.first is rate
        // i.second is requirement
        auto room = roomss.lower_bound(make_pair(i.second,(ll)0));
        if(room==roomss.end()){ continue;}
        if(room->second<i.first){
            // Rate is gud
            ans.emplace_back(i.first-room->second);
            roomss.erase(room);
        }
    }
    sort(allr(ans));
    ll anss = 0;
    for (int i = 0; i < min(o,ans.size()); i++) {
        anss += ans[i];
    }
    cout << anss;
}

Compilation message

hot.cpp: In function 'int main()':
hot.cpp:45:41: error: no matching function for call to 'min(ll&, std::vector<long long unsigned int>::size_type)'
   45 |     for (int i = 0; i < min(o,ans.size()); i++) {
      |                                         ^
In file included from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from hot.cpp:6:
/usr/include/c++/10/bits/stl_algobase.h:230:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  230 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:230:5: note:   template argument deduction/substitution failed:
hot.cpp:45:41: note:   deduced conflicting types for parameter 'const _Tp' ('long long unsigned int' and 'std::vector<long long unsigned int>::size_type' {aka 'long unsigned int'})
   45 |     for (int i = 0; i < min(o,ans.size()); i++) {
      |                                         ^
In file included from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from hot.cpp:6:
/usr/include/c++/10/bits/stl_algobase.h:278:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  278 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:278:5: note:   template argument deduction/substitution failed:
hot.cpp:45:41: note:   deduced conflicting types for parameter 'const _Tp' ('long long unsigned int' and 'std::vector<long long unsigned int>::size_type' {aka 'long unsigned int'})
   45 |     for (int i = 0; i < min(o,ans.size()); i++) {
      |                                         ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from hot.cpp:6:
/usr/include/c++/10/bits/stl_algo.h:3468:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)'
 3468 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3468:5: note:   template argument deduction/substitution failed:
hot.cpp:45:41: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long unsigned int'
   45 |     for (int i = 0; i < min(o,ans.size()); i++) {
      |                                         ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from hot.cpp:6:
/usr/include/c++/10/bits/stl_algo.h:3474:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)'
 3474 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3474:5: note:   template argument deduction/substitution failed:
hot.cpp:45:41: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long unsigned int'
   45 |     for (int i = 0; i < min(o,ans.size()); i++) {
      |                                         ^