Language: C++

#include<bits/stdc++.h>
using namespace std;
#define INF 1000000007
int main(void){
	int n;
	cin >> n;
	int k[n][3];
	
	for(int i = 0; i < n; i++) cin >> k[i][0] >> k[i][1] >> k[i][2];
	int we[1 << n];{
	for(int i = 0; i < (1 << n); i++){
		we[i] = 0;
		for(int j = 0; j < n; j++){
			if(!(i & (1 << i))) we[i] += k[i][2] * 20;
		}
	}
	double dp[1 << n][2];
	int ro[1 << n];
	fill(dp, dp + (1 << n), INF); fill(ro, ro + (1 << n), -1);
	dp[0][0] = 0; dp[0][1] = -1; ro[0] = -1;
	for(int i = 0; i < (1 << n); i++){
		if(dp[i][0] != INF){
			for(int j = 0; j < n; j++){
				if(!(i & (1 << i))){
					double cost;
					if(i == 0) cost = k[j][1] / (2000 / 70);
					else if(i + (i << j) == (1 << n - 1){
						cost = abs(k[dp[i][1]][1] - k[j][1]) / (2000 / (70 + we[i]);
						cost += abs(k[n - 1][1] - k[j][1]) / (2000 / (70 + we[1 << n - 1]);
					}
					else cost = abs(k[dp[i][1]][1] - k[j][1]) / (2000 / (70 + we[i]);
					if(dp[i + (i << j)][0] > dp[i][0] + cost){
						dp[i + (i << j)][0] = dp[i][0] + cost;
						dp[i + (i << j)][1] = j;
						ro[i + (i << j)] = i;
					}
				}
			}
		}
	}
	int ans[n], p = 1 << n - 1;
	for(int i = n - 1; i >= 0; i--){
		ans[i] = ro[p];
		p = ro[p];
	}
	cout << ans[0];
	for(int i = 1; i < n; i++) cout << ' ' << ans[i];
	cout << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:77: error: expected ')' before '{' token
   27 |                                         else if(i + (i << j) == (1 << n - 1){
      |                                                ~                            ^
      |                                                                             )
a.cc:50:2: error: expected '}' at end of input
   50 | }
      |  ^
a.cc:4:15: note: to match this '{'
    4 | int main(void){
      |               ^
In file included 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_algobase.h: In instantiation of 'typename __gnu_cxx::__enable_if<std::__is_scalar<_Tp>::__value, void>::__type std::__fill_a1(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = double (*)[2]; _Tp = int; typename __gnu_cxx::__enable_if<__is_scalar<_Tp>::__value, void>::__type = void]':
/usr/include/c++/14/bits/stl_algobase.h:998:21:   required from 'void std::__fill_a(_FIte, _FIte, const _Tp&) [with _FIte = double (*)[2]; _Tp = int]'
  998 |     { std::__fill_a1(__first, __last, __value); }
      |       ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:1029:20:   required from 'void std::fill(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = double (*)[2]; _Tp = int]'
 1029 |       std::__fill_a(__first, __last, __value);
      |       ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:19:6:   required from here
   19 |         fill(dp, dp + (1 << n), INF); fill(ro, ro + (1 << n), -1);
      |         ~~~~^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:952:18: error: incompatible types in assignment of 'const int' to 'double [2]'
  952 |         *__first = __tmp;
      |         ~~~~~~~~~^~~~~~~