Submission #394961

# Submission time Handle Problem Language Result Execution time Memory
394961 2021-04-27T14:26:43 Z ak2006 Hotel (CEOI11_hot) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vb = vector<bool>;
using vvb = vector<vb>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vc = vector<char>;
using vvc = vector<vc>;
const ll mod = 1e9 + 7,inf = 1e18;
#define pb push_back
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int n,m,o;
ll out;
bool cmp2(vl&f,vl&s)
{
    return (f[1] > s[1]) or (f[1] == s[1] && s[0] < s[0]);
}
int main()
{
    cin>>n>>m>>o;
    vvl a(n,vl(2));
    set<vl>s;
    for (int i = 0;i<n;i++)cin>>a[i][0]>>a[i][1],s.insert({a[i][1],a[i][0],i + 1});
    vl profits;
    vvl offers(m,vl(2));
    for (int i = 0;i<m;i++)cin>>offers[i][0]>>offers[i][1];
    sort(offers.begin(),offers.end(),cmp2);
    for (int i = 0;i<o;i++){
        auto it = s.lower_bound({offers[i][1],0,0});
        if (it == s.end())continue;
        profits.pb(offers[i][0] - (*it)[1]);
        s.erase(it);
    }
    sort(profits.rbegin(),profits.rend());
    for (int i = 0;i<min(o - 1,profits.size() - 1);i++)out += profits[i];
    cout<<out;
    return 0;
}

Compilation message

hot.cpp: In function 'int main()':
hot.cpp:38:50: error: no matching function for call to 'min(int, std::vector<long long int>::size_type)'
   38 |     for (int i = 0;i<min(o - 1,profits.size() - 1);i++)out += profits[i];
      |                                                  ^
In file included from /usr/include/c++/9/bits/char_traits.h:39,
                 from /usr/include/c++/9/ios:40,
                 from /usr/include/c++/9/istream:38,
                 from /usr/include/c++/9/sstream:38,
                 from /usr/include/c++/9/complex:45,
                 from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from hot.cpp:1:
/usr/include/c++/9/bits/stl_algobase.h:198:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  198 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/9/bits/stl_algobase.h:198:5: note:   template argument deduction/substitution failed:
hot.cpp:38:50: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'})
   38 |     for (int i = 0;i<min(o - 1,profits.size() - 1);i++)out += profits[i];
      |                                                  ^
In file included from /usr/include/c++/9/bits/char_traits.h:39,
                 from /usr/include/c++/9/ios:40,
                 from /usr/include/c++/9/istream:38,
                 from /usr/include/c++/9/sstream:38,
                 from /usr/include/c++/9/complex:45,
                 from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from hot.cpp:1:
/usr/include/c++/9/bits/stl_algobase.h:246:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  246 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/9/bits/stl_algobase.h:246:5: note:   template argument deduction/substitution failed:
hot.cpp:38:50: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'})
   38 |     for (int i = 0;i<min(o - 1,profits.size() - 1);i++)out += profits[i];
      |                                                  ^
In file included from /usr/include/c++/9/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from hot.cpp:1:
/usr/include/c++/9/bits/stl_algo.h:3444:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)'
 3444 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/9/bits/stl_algo.h:3444:5: note:   template argument deduction/substitution failed:
hot.cpp:38:50: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   38 |     for (int i = 0;i<min(o - 1,profits.size() - 1);i++)out += profits[i];
      |                                                  ^
In file included from /usr/include/c++/9/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from hot.cpp:1:
/usr/include/c++/9/bits/stl_algo.h:3450:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)'
 3450 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/9/bits/stl_algo.h:3450:5: note:   template argument deduction/substitution failed:
hot.cpp:38:50: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   38 |     for (int i = 0;i<min(o - 1,profits.size() - 1);i++)out += profits[i];
      |                                                  ^