Submission #473172

# Submission time Handle Problem Language Result Execution time Memory
473172 2021-09-15T09:45:14 Z Mr_Ph San (COCI17_san) C++14
Compilation error
0 ms 0 KB
///made by : Mr_Ph :D
#include<bits/stdc++.h>
#include<unordered_map>
typedef long long ll;
typedef long long int lli;
typedef unsigned long long ull;
using namespace std;
const double PI=acos(-1.0);
const ll mod=(ll)1e9+7;
//int dx[4] = {0, 0, 1, -1};
//int dy[4] = {1, -1, 0, 0};
///the defines :)
#define endl '\n'
#define vi vector<int>
#define vll vector<ll>
#define lower(s) transform(s.begin(),s.end(),s.begin(),::tolower)
#define upper(s) transform(s.begin(),s.end(),s.begin(),::toupper)
#define ent(arr) for(int i=0;i<arr.size();i++)cin>>arr[i];
#define all(arr) arr.begin(),arr.end()
#define allr(arr) arr.rbegin(),arr.rend()
#define sz size()
///the end of the defines ;)
void solve()
{
    ll n,k;
    cin>>n>>k;
    vector<pair<ll,ll>>arr(n);
    for(int i=0; i<n; i++)
        cin>>arr[i].first>>arr[i].second;
    set<vector<ll>>st;
    for(ll i=0; i<(1<<n); i++)
    {
        vi temp;
        ll sum=0;
        ll prv=0;
        for(ll e=0; e<n; e++)
        {
            ll Try=(1<<e)&i;
            if(Try)
            {
                if(arr[e].first>=prv)
                {
                    prv=arr[e].first;
                    temp.push_back(e);
                    sum+=arr[e].second;
                }
            }
        }
        if(sum>=k)
            st.insert(temp);
    }
    cout<<st.sz<<endl;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(0);
    //freopen("window.in","r",stdin);
    //freopen("output.txt","w",stdout);
    int t=1;//int st;
    //cin>>t;//cin>>st;
    while(t--)
        solve();
}

Compilation message

san.cpp: In function 'void solve()':
san.cpp:50:27: error: no matching function for call to 'std::set<std::vector<long long int> >::insert(std::vector<int>&)'
   50 |             st.insert(temp);
      |                           ^
In file included from /usr/include/c++/10/set:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:87,
                 from san.cpp:2:
/usr/include/c++/10/bits/stl_set.h:509:7: note: candidate: 'std::pair<typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator, bool> std::set<_Key, _Compare, _Alloc>::insert(const value_type&) [with _Key = std::vector<long long int>; _Compare = std::less<std::vector<long long int> >; _Alloc = std::allocator<std::vector<long long int> >; typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator = std::_Rb_tree<std::vector<long long int>, std::vector<long long int>, std::_Identity<std::vector<long long int> >, std::less<std::vector<long long int> >, std::allocator<std::vector<long long int> > >::const_iterator; std::set<_Key, _Compare, _Alloc>::value_type = std::vector<long long int>]'
  509 |       insert(const value_type& __x)
      |       ^~~~~~
/usr/include/c++/10/bits/stl_set.h:509:32: note:   no known conversion for argument 1 from 'std::vector<int>' to 'const value_type&' {aka 'const std::vector<long long int>&'}
  509 |       insert(const value_type& __x)
      |              ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_set.h:518:7: note: candidate: 'std::pair<typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator, bool> std::set<_Key, _Compare, _Alloc>::insert(std::set<_Key, _Compare, _Alloc>::value_type&&) [with _Key = std::vector<long long int>; _Compare = std::less<std::vector<long long int> >; _Alloc = std::allocator<std::vector<long long int> >; typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator = std::_Rb_tree<std::vector<long long int>, std::vector<long long int>, std::_Identity<std::vector<long long int> >, std::less<std::vector<long long int> >, std::allocator<std::vector<long long int> > >::const_iterator; std::set<_Key, _Compare, _Alloc>::value_type = std::vector<long long int>]'
  518 |       insert(value_type&& __x)
      |       ^~~~~~
/usr/include/c++/10/bits/stl_set.h:518:27: note:   no known conversion for argument 1 from 'std::vector<int>' to 'std::set<std::vector<long long int> >::value_type&&' {aka 'std::vector<long long int>&&'}
  518 |       insert(value_type&& __x)
      |              ~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_set.h:546:7: note: candidate: 'std::set<_Key, _Compare, _Alloc>::iterator std::set<_Key, _Compare, _Alloc>::insert(std::set<_Key, _Compare, _Alloc>::const_iterator, const value_type&) [with _Key = std::vector<long long int>; _Compare = std::less<std::vector<long long int> >; _Alloc = std::allocator<std::vector<long long int> >; std::set<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree<std::vector<long long int>, std::vector<long long int>, std::_Identity<std::vector<long long int> >, std::less<std::vector<long long int> >, std::allocator<std::vector<long long int> > >::const_iterator; std::set<_Key, _Compare, _Alloc>::const_iterator = std::_Rb_tree<std::vector<long long int>, std::vector<long long int>, std::_Identity<std::vector<long long int> >, std::less<std::vector<long long int> >, std::allocator<std::vector<long long int> > >::const_iterator; std::set<_Key, _Compare, _Alloc>::value_type = std::vector<long long int>]'
  546 |       insert(const_iterator __position, const value_type& __x)
      |       ^~~~~~
/usr/include/c++/10/bits/stl_set.h:546:7: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/10/bits/stl_set.h:551:7: note: candidate: 'std::set<_Key, _Compare, _Alloc>::iterator std::set<_Key, _Compare, _Alloc>::insert(std::set<_Key, _Compare, _Alloc>::const_iterator, std::set<_Key, _Compare, _Alloc>::value_type&&) [with _Key = std::vector<long long int>; _Compare = std::less<std::vector<long long int> >; _Alloc = std::allocator<std::vector<long long int> >; std::set<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree<std::vector<long long int>, std::vector<long long int>, std::_Identity<std::vector<long long int> >, std::less<std::vector<long long int> >, std::allocator<std::vector<long long int> > >::const_iterator; std::set<_Key, _Compare, _Alloc>::const_iterator = std::_Rb_tree<std::vector<long long int>, std::vector<long long int>, std::_Identity<std::vector<long long int> >, std::less<std::vector<long long int> >, std::allocator<std::vector<long long int> > >::const_iterator; std::set<_Key, _Compare, _Alloc>::value_type = std::vector<long long int>]'
  551 |       insert(const_iterator __position, value_type&& __x)
      |       ^~~~~~
/usr/include/c++/10/bits/stl_set.h:551:7: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/10/bits/stl_set.h:566:2: note: candidate: 'template<class _InputIterator> void std::set<_Key, _Compare, _Alloc>::insert(_InputIterator, _InputIterator) [with _InputIterator = _InputIterator; _Key = std::vector<long long int>; _Compare = std::less<std::vector<long long int> >; _Alloc = std::allocator<std::vector<long long int> >]'
  566 |  insert(_InputIterator __first, _InputIterator __last)
      |  ^~~~~~
/usr/include/c++/10/bits/stl_set.h:566:2: note:   template argument deduction/substitution failed:
san.cpp:50:27: note:   candidate expects 2 arguments, 1 provided
   50 |             st.insert(temp);
      |                           ^
In file included from /usr/include/c++/10/set:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:87,
                 from san.cpp:2:
/usr/include/c++/10/bits/stl_set.h:578:7: note: candidate: 'void std::set<_Key, _Compare, _Alloc>::insert(std::initializer_list<_Tp>) [with _Key = std::vector<long long int>; _Compare = std::less<std::vector<long long int> >; _Alloc = std::allocator<std::vector<long long int> >]'
  578 |       insert(initializer_list<value_type> __l)
      |       ^~~~~~
/usr/include/c++/10/bits/stl_set.h:578:43: note:   no known conversion for argument 1 from 'std::vector<int>' to 'std::initializer_list<std::vector<long long int> >'
  578 |       insert(initializer_list<value_type> __l)
      |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~