43062023-03-23 11:07:401478Kígyózó szavakcpp17Compilation error
#include <bits/stdc++.h>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int h, n;
    cin>>h>>n;
    vector<vector<long long>> dp(h+1, vector<long long>(27));
    //vector<int> tas

    for(int i=1; i<=26; i++){
        dp[1][i] = 1;
    }

    for(int i=2; i<=h; i++){
        for(int j = 1; j<=26; j++){
            if(j>1) dp[i][j] += dp[i-1][j-1];
            if(j<26) dp[i][j] += dp[i-1][j+1];
            dp[i][j]=min(dp[i][j],1000000000);
        }
    }

    for(int i=2; i<=h; i++){
        for(int j=1; j<=26; j++){
            dp[i][j] += dp[i-1][j];
        }
    }

    for(int i=1; i<=n; i++){
        string sol;
        int k, g = h;
        cin>>k;
        int ind = 1;
        while(k-dp[g][ind] > 0){
            k -= dp[g][ind];
            ++ind;
        }
        sol +='a' + ind - 1;
        //cout<<sol<<" ";
        //cout<<k<<": ";
        bool ok = 0;
        while(1){
            k--;
            g--;
            if(k <= 0) {
                break;
            }
            if(ind > 1 && ind < 26){
                if(k-dp[g][ind-1] > 0) {
                    sol+='a'+ind;
                    //cout<<sol<<" ";

                    k -= dp[g][ind-1];
                    //cout<<k<<endl;
                    ind++;
                }
                else{
                    sol+='a'+ind-2;
                    //cout<<sol<<" "<<k<<endl;
                    ind--;
                }
            }
            else if(ind == 1){
                sol+='b';
                ind++;
            }
            else if(ind == 26){
                sol+='y';
                ind--;
            }
        }
        cout<<sol<<endl;
    }
    return 0;
}
Compilation error
exit status 1
main.cpp: In function 'int main()':
main.cpp:22:25: error: no matching function for call to 'min(__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type&, int)'
   22 |             dp[i][j]=min(dp[i][j],1000000000);
      |                      ~~~^~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/bits/specfun.h:45,
                 from /usr/include/c++/11/cmath:1935,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41,
                 from main.cpp:1:
/usr/include/c++/11/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++/11/bits/stl_algobase.h:230:5: note:   template argument deduction/substitution failed:
main.cpp:22:25: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   22 |             dp[i][j]=min(dp[i][j],1000000000);
      |                      ~~~...