Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
#include<cstdio>
#include<queue>
using namespace std;
struct Edge{
    int to;
    int cost;
    Edge(){};
    Edge(int _to,int _cost){
        to = _to;
        cost = _cost;
    }
};
struct Data{
    int pos;
    int tic;
    double t;
    Data(){};
    Data(int _pos,int _tic,double _t){
        pos = _pos;
        tic = _tic;
        t = _t;
    }
    bool operator<(const Data &d)const{
        return t > d.t;
    }
};
int main(){
    int n,m,p,a,b;
    while(cin>>n>>m>>p>>a>>b,n||m||p||a||b){
        int tick[10];
        for(int i = 0;i < n;i++)cin>>tick[i];
        vector<Edge> Node[50];
        for(int i = 0;i < p;i++){
            int x,y,z;
            cin>>x>>y>>z;
            Node[x].push_back(Edge(y,z));
            Node[y].push_back(Edge(x,z));
        }
        //cout<<"!"<<endl;
        priority_queue<Data> Q;
        Q.push(Data(a,0,0));
        double vis[50][1000];
        for(int i = 0;i < 1000;i++){
            for(int j = 0;j < 50;j++){
                vis[j][i] = 1e+9;
            }
        }
        vis[a][0] = 0;
        bool flg = false;
        while(!Q.empty()){
            Data D = Q.top();Q.pop();
            //if(D.t<3)cout<<D.pos<<" "<<D.tic<<" "<<D.t<<endl;
            int Pos = D.pos;
            
            if(vis[Pos][D.tic] < D.t)continue;
            vis[Pos][D.tic] = D.t;
            for(int i = 0;i < Node[Pos].size();i++){
                Edge e = Node[Pos][i];
                for(int j = 0;j < n;j++){
                    if((1<<j)&D.tic)continue;
                    int c = D.tic|(1<<j);
                    double nt = D.t + ((double)e.cost/(double)tick[j]);
                    if(vis[e.to][c] < nt)continue;
                    vis[e.to][c] = nt;
                    Q.push(Data(e.to,c,nt));
                }
            }
        }
        int ans = 1e+9;
        for(int i = 0;i < (1<<8);i++)ans = min(ans,vis[b][i]);
        if(ans == 1e+9)cout<<"Impossible"<<endl;
        else cout<<ans<<endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:73:47: error: no matching function for call to 'min(int&, double&)'
   73 |         for(int i = 0;i < (1<<8);i++)ans = min(ans,vis[b][i]);
      |                                            ~~~^~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:73:47: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'double')
   73 |         for(int i = 0;i < (1<<8);i++)ans = min(ans,vis[b][i]);
      |                                            ~~~^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:73:47: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   73 |         for(int i = 0;i < (1<<8);i++)ans = min(ans,vis[b][i]);
      |                                            ~~~^~~~~~~~~~~~~~~