143792025-01-10 17:50:14UVinceFestés (50 pont)cpp17Compilation error
#include <bits/stdc++.h>
using namespace std;
using ll=long long;

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int n,m;
    cin>>n>>m;

    vector<ll> rcost(n);
    for (auto &i : rcost) cin>>i;
    vector<vector<vector<int>>> ccost(m, vector<vector<ll>> (n, vector<int> (n, -1)));
    for (auto &c : ccost){
        for (int i=0;i<n;i++){
            for (int j=i;j<n;j++){
                cin>>c[i][j];
            }
        }
    }
    

    ll ans=INT_MAX;

    for (int bitmask=0;bitmask<(1<<n);bitmask++){
        ll cost=0;
        for (int i=0;i<n;i++) if ((bitmask>>i) & 1) cost+=rcost[i];
        for (int i=0;i<m;i++){
            vector<ll> dp(n+1, INT_MAX);
            dp[0]=0;
            for (int j=1;j<=n;j++) {
                if ((bitmask>>(j-1)) & 1) dp[j]=dp[j-1];
                else {
                    dp[j]=ccost[i][0][j-1];
                    for (int k=2;k<=j;k++){
                        dp[j]=min(dp[j], dp[k-1]+ccost[i][k-1][j-1]);
                    }
                }
            }
            cost+=dp[n];
        }
        ans=min(ans,cost);
    }
    cout<<ans;
}
Compilation error
open /var/local/lib/isolate/425/box/a.out: no such file or directory
main.cpp: In function 'int main()':
main.cpp:14:84: error: no matching function for call to 'std::vector<std::vector<long long int> >::vector(int&, std::vector<int>)'
   14 |     vector<vector<vector<int>>> ccost(m, vector<vector<ll>> (n, vector<int> (n, -1)));
      |                                                                                    ^
In file included from /usr/include/c++/12/vector:64,
                 from /usr/include/c++/12/functional:62,
                 from /usr/include/x86_64-linux-gnu/c++/12/bits/stdc++.h:71,
                 from main.cpp:1:
/usr/include/c++/12/bits/stl_vector.h:702:9: note: candidate: 'template<class _InputIterator, class> std::vector<_Tp, _Alloc>::vector(_InputIterator, _InputIterator, const allocator_type&) [with <template-parameter-2-2> = _InputIterator; _Tp = std::vector<long long int>; _Alloc = std::allocator<std::vector<long long int> >]'
  702 |         vector(_InputIterator __first, _InputIterator __last,
      |         ^~~~~~
/usr/include/c++/12/bits/stl_vector.h:702:9: note:   template argument deduction/substitution failed:
main.cpp:14:84: note:   deduced conflicting types for parameter '_InputIterator' ('int' and 'std::vector<int>')
   14 |     vector<vector<vector<int>>> ccost(m, vector<vector<ll>> (n, vector<int> (n, -1)));
      |                                                                                    ^
/usr/include/c++/12/bits/stl_vector.h:673:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::initializer_list<_Tp>, const allocator_type&) [with _Tp = std::vector<long long int>; _Alloc = std::allocator<std::vector<long long int> >; allocator_type = std::allocator<std::vector<long long int> >]'
  673 |       vector(initializer_list<value_type> __l,
      |       ^~~~~~
/usr/include/c++/12/bits/stl_vector.h:673:43: note:   no known conversion for argument 1 from 'int' to 'std::initializer_list<std::vector<long long int> >'
  673 |       vector(initializer_list<value_...