Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const int INF=1e9;

int main(){
    int c[10]={0,2,5,5,4,5,6,3,7,6};
    int n,m;
    pair<int,int> a[9];
    cin>>n>>m;
    for(int i=0;i<m;i++){
        int t;
        cin>>t;
        a[i]={c[t],-t};
    }
    sort(a,a+m);
    pair<int,int> dp[n+10];
    int ans[n+10];
    dp[0]=0;
    for(int i=1;i<n+10;i++){
        dp[i]={-INF,-INF};
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            if(dp[i+a[j].first].first<=dp[i].frist+1&&dp[i+a[j]].second]<max(dp[i].second,a[j].second)){
                dp[i+a[j].first].first=dp[i].frist+1;
                dp[i+a[j]].second]=max(dp[i].second,-a[j].second);
                ans[i+a[j].first]=-a[j].second;
            }
        }
    }
    int crt=n;
    vector<int> v;
    while(crt!=0){
        v.push_back(ans[crt]);
        crt-=c[ans[crt]];
    }
    sort(v.begin(),v.end(),greater<int>());
    for(int i:v){
        cout<<i;
    }
    cout<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:11: error: no match for 'operator=' (operand types are 'std::pair<int, int>' and 'int')
   20 |     dp[0]=0;
      |           ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_pair.h:946:9: note: candidate: 'template<class _U1, class _U2> typename std::enable_if<std::__and_<std::is_assignable<_T1&, const _U1&>, std::is_assignable<_T2&, const _U2&> >::value, std::pair<_T1, _T2>&>::type std::pair<_T1, _T2>::operator=(const std::pair<_U1, _U2>&) [with _U2 = _U1; _T1 = int; _T2 = int]'
  946 |         operator=(const pair<_U1, _U2>& __p)
      |         ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:946:9: note:   template argument deduction/substitution failed:
a.cc:20:11: note:   mismatched types 'const std::pair<_T1, _T2>' and 'int'
   20 |     dp[0]=0;
      |           ^
/usr/include/c++/14/bits/stl_pair.h:957:9: note: candidate: 'template<class _U1, class _U2> typename std::enable_if<std::__and_<std::is_assignable<_T1&, _U1&&>, std::is_assignable<_T2&, _U2&&> >::value, std::pair<_T1, _T2>&>::type std::pair<_T1, _T2>::operator=(std::pair<_U1, _U2>&&) [with _U2 = _U1; _T1 = int; _T2 = int]'
  957 |         operator=(pair<_U1, _U2>&& __p)
      |         ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:957:9: note:   template argument deduction/substitution failed:
a.cc:20:11: note:   mismatched types 'std::pair<_T1, _T2>' and 'int'
   20 |     dp[0]=0;
      |           ^
/usr/include/c++/14/bits/stl_pair.h:921:7: note: candidate: 'std::pair<_T1, _T2>& std::pair<_T1, _T2>::operator=(std::__conditional_t<((bool)std::__and_<std::is_copy_assignable<_T1>, std::is_copy_assignable<_T2> >::value), const std::pair<_T1, _T2>&, const std::__nonesuch&>) [with _T1 = int; _T2 = int; std::__conditional_t<((bool)std::__and_<std::is_copy_assignable<_T1>, std::is_copy_assignable<_T2> >::value), const std::pair<_T1, _T2>&, const std::__nonesuch&> = const std::pair<int, int>&]'
  921 |       operator=(__conditional_t<__and_<is_copy_assignable<_T1>,
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:923:65: note:   no known conversion for argument 1 from 'int' to 'std::__conditional_t<true, const std::pair<int, int>&, const std::__nonesuch&>' {aka 'const std::pair<int, int>&'}
  921 |       operator=(__conditional_t<__and_<is_copy_assignable<_T1>,
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
  922 |                                        is_copy_assignable<_T2>>::value,
      |                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  923 |                                 const pair&, const __nonesuch&> __p)
      |                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_pair.h:931:7: note: candidate: 'std::pair<_T1, _T2>& std::pair<_T1, _T2>::operator=(std::__conditional_t<((bool)std::__and_<std::is_move_assignable<_Tp>, std::is_move_assignable<_T2> >::value), std::pair<_T1, _T2>&&, std::__nonesuch&&>) [with _T1 = int; _T2 = int; std::__conditional_t<((bool)std::__and_<std::is_move_assignable<_Tp>, std::is_move_assignable<_T2> >::value), std::pair<_T1, _T2>&&, std::__nonesuch&&> = std::pair<int, int>&&]'
  931 |       operator=(__conditional_t<__and_<is_move_assignable<_T1>,
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:933:55: note:   no known conversion for argument 1 from 'int' to 'std::__conditional_t<true, std::pair<int, int>&&, std::__nonesuch&&>' {aka 'std::pair<int, int>&&'}
  931 |       operator=(__conditional_t<__and_<is_move_assignable<_T1>,
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  932 |                                        is_move_assignable<_T2>>::value,
      |                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  933 |                                 pair&&, __nonesuch&&> __p)
      |                                 ~~~~~~~~~~~~~~~~~~~~~~^~~
a.cc:26:46: error: 'struct std::pair<int, int>' has no member named 'frist'; did you mean 'first'?
   26 |             if(dp[i+a[j].first].first<=dp[i].frist+1&&dp[i+a[j]].second]<max(dp[i].second,a[j].second)){
      |                                              ^~~~~
      |                                              first
a.cc:26:59: error: no match for 'operator+' (operand types are 'int' and 'std::pair<int, int>')
   26 |             if(dp[i+a[j].first].first<=dp[i].frist+1&&dp[i+a[j]].second]<max(dp[i].second,a[j].second)){
      |                                                          ~^~~~~
      |                                                          |    |
      |                                                          int  std::pair<int, int>
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:627:5: note: candidate: 'template<class _Iterator> constexpr std::reverse_iterator<_Iterator> std::operator+(typename reverse_iterator<_Iterator>::difference_type, const reverse_iterator<_Iterator>&)'
  627 |     operator+(typename reverse_iterator<_Iterator>::difference_type __n,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:627:5: note:   template argument deduction/substitution failed:
a.cc:26:63: note:   'std::pair<int, int>' is not derived from 'const std::reverse_iterator<_Iterator>'
   26 |             if(dp[i+a[j].first].first<=dp[i].frist+1&&dp[i+a[j]].second]<max(dp[i].second,a[j].second)){
      |                                                               ^
/usr/include/c++/14/bits/stl_iterator.h:1798:5: note: candidate: 'template<class _Iterator> constexpr std::move_iterator<_IteratorL> std::operator+(typename move_iterator<_IteratorL>::difference_type, const move_iterator<_IteratorL>&)'
 1798 |     operator+(typename move_iterator<_Iterator>::difference_type __n,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1798:5: note:   template argument deduction/substitution failed:
a.cc:26:63: note:   'std::pair<int, int>' is not derived from 'const std::move_iterator<_IteratorL>'
   26 |             if(dp[i+a[j].first].first<=dp[i].frist+1&&dp[i+a[j]].second]<max(dp[i].second,a[j].second)){
      |                                                               ^
In file included from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/bits/basic_string.h:3598:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
 3598 |     operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3598:5: note:   template argument deduction/substitution failed:
a.cc:26:63: note:   mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int'
   26 |             if(dp[i+a[j].first].first<=dp[i].frist+1&&dp[i+a[j]].second]<max(dp[i].second,a[j].second)){
      |                                                               ^
/usr/include/c++/14/bits/basic_string.h:3616:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
 3616 |     operator+(const _CharT* __lhs,
      |     ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3616:5: note:   template argument deduction/substitution failed:
a.cc:26:63: note:   mismatched types 'const _CharT*' and 'int'
   26 |             if(dp[i+a[j].first].first<=dp[i].frist+1&&dp[i+a[j]].second]<max(dp[i].second,a[j].second)){
      |                                                               ^
/usr/include/c++/14/bits/basic_string.h:3635:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
 3635 |     operator+(_CharT __lhs, const basic_string<_CharT,_Traits,_Alloc>& __rhs)
      |     ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3635:5: note:   template argument deduction/substitution failed:
a.cc:26:63: note:   'std::pair<int, int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
   26 |             if(dp[i+a[j].first].first<=dp[i].frist+1&&dp[i+a[j]].second]<max(dp[i].second,a[j].second)){
      |                                                               ^
/usr/include/c++/14/bits/basic_string.h:3652:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
 3652 |     operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3652:5: note:   template argument deduction/substitution failed:
a.cc:26:63: note:   mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int'
   26 |             if(dp[i+a[j].first].first<=dp[i].frist+1&&dp[i+a[j]].second]<max(dp[i].second,a[j].second)){
      |                                                               ^
/usr/include/c++/14/bits/basic_string.h:3670:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, _CharT)'
 3670 |     operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, _CharT __rhs)
      |     ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3670:5: note:   template argument deduction/substitution failed:
a.cc:26:63: note:   mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int'
   26 |             if(dp[i+a[j].firs