Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <map>

using namespace std;
typedef  long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define  MP make_pair
#define  PB push_back
#define inf  1000000007
#define rep(i,n) for(int i=0;i<(int)(n);++i)

ll l[201][201];
ll s[201][201];
ll dp[1001][201];


int main(){
	int n,m,r;
	while(cin >> n >> m && n!=0){
		for(int i=0;i<200;i++){
			for(int j=0;j<200;j++){
				l[i][j] = inf;
				s[i][j] = inf;
				if(i==j){
					l[i][j] = 0;
					s[i][j] = 0;
				}
			}
		}
		for(int i=0;i<m;i++){
			int x,y,t;
			char c;
			cin >> x >> y >> t >> c;
			x--;
			y--;
			if(c=='L'){
				l[x][y] = min(l[x][y],t);
				l[y][x] = min(l[x][y],t);
			}else{
				s[x][y] = min(s[x][y],t);
				s[y][x] = min(s[x][y],t);
			}
		}
		for(int k=0;k<n;k++){
			for(int i=0;i<n;i++){
				for(int j=0;j<n;j++){
					l[i][j] = min(l[i][k]+l[k][j],l[i][j]);
					s[i][j] = min(s[i][k]+s[k][j],s[i][j]);
				}
			}
		}
		cin >> r;
		vector<int> z(r);
		for(int i=0;i<r;i++){
			cin >> z[i];
			z[i]--;
		}
		for(int i=0;i<r;i++){
			for(int j=0;j<n;j++){
				dp[i][j] = inf;
			}
		}
		for(int i=0;i<r;i++){
			for(int j=0;j<n;j++){
				dp[i][j] = inf;
			}
		}
		dp[0][z[0]] = 0;
		for(int i=1;i<r;i++){
			for(int j=0;j<n;j++){
				for(int k=0;k<n;k++){
					dp[i][j] = min(dp[i][j],dp[i-1][k]+l[z[i-1]][k]+s[k][j]+l[j][z[i]]);
				}
			}
		}
		ll ans = inf;
		for(int i=0;i<n;i++){
			ans = min(ans,dp[r-1][i]);
		}
		cout << ans << endl;
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:46:46: error: no matching function for call to 'min(ll&, int&)'
   46 |                                 l[x][y] = min(l[x][y],t);
      |                                           ~~~^~~~~~~~~~~
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:46:46: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   46 |                                 l[x][y] = min(l[x][y],t);
      |                                           ~~~^~~~~~~~~~~
/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:5:
/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:46:46: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   46 |                                 l[x][y] = min(l[x][y],t);
      |                                           ~~~^~~~~~~~~~~
a.cc:47:46: error: no matching function for call to 'min(ll&, int&)'
   47 |                                 l[y][x] = min(l[x][y],t);
      |                                           ~~~^~~~~~~~~~~
/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:47:46: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   47 |                                 l[y][x] = min(l[x][y],t);
      |                                           ~~~^~~~~~~~~~~
/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
/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:47:46: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   47 |                                 l[y][x] = min(l[x][y],t);
      |                                           ~~~^~~~~~~~~~~
a.cc:49:46: error: no matching function for call to 'min(ll&, int&)'
   49 |                                 s[x][y] = min(s[x][y],t);
      |                                           ~~~^~~~~~~~~~~
/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:49:46: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   49 |                                 s[x][y] = min(s[x][y],t);
      |                                           ~~~^~~~~~~~~~~
/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
/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:49:46: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   49 |                                 s[x][y] = min(s[x][y],t);
      |                                           ~~~^~~~~~~~~~~
a.cc:50:46: error: no matching function for call to 'min(ll&, int&)'
   50 |                                 s[y][x] = min(s[x][y],t);
      |                                           ~~~^~~~~~~~~~~
/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:50:46: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   50 |                                 s[y][x] = min(s[x][y],t);
      |                                           ~~~^~~~~~~~~~~
/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
/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:50:46: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   50 |                                 s[y][x] = min(s[x][y],t);
      |                                           ~~~^~~~~~~~~~~