답안 #98478

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
98478 2019-02-23T18:33:59 Z pamaj Kronican (COCI16_kronican) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
const int maxn = 20;
#define int long long

int n, k;
int c[maxn][maxn];
int dp[1 << 20];
int dist[maxn];
int qt;
int solve(int mask)
{
	if(__builtin_popcount(mask) >= n - k) return 0;

	if(dp[mask] != -1) return dp[mask];

	int ans = 1e9;
	for(int i = 0; i < n; i++)
	{
		for(int j = 0; j < n; j++)
		{
			if(i == j or (mask & (1 << i)) or (mask & (1 << j))) continue;

			ans = min(ans, solve(mask | (1 << i)) + c[i][j]);
		}
	}

	return dp[mask] = ans;
}


int32_t main()
{
	cin >> n >> k;

	for(int i = 0; i < n; i++)
	{
		for(int j = 0; j < n; j++)
			cin >> c[i][j];
	}

	memset(dp, -1, sizeof(dp));

	qt = min(n - k, 0);

	cout << solve(0) << "\n";

}

Compilation message

kronican.cpp: In function 'int32_t main()':
kronican.cpp:44:19: error: no matching function for call to 'min(long long int, int)'
  qt = min(n - k, 0);
                   ^
In file included from /usr/include/c++/7/bits/char_traits.h:39:0,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/istream:38,
                 from /usr/include/c++/7/sstream:38,
                 from /usr/include/c++/7/complex:45,
                 from /usr/include/c++/7/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
                 from kronican.cpp:1:
/usr/include/c++/7/bits/stl_algobase.h:195:5: note: candidate: template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)
     min(const _Tp& __a, const _Tp& __b)
     ^~~
/usr/include/c++/7/bits/stl_algobase.h:195:5: note:   template argument deduction/substitution failed:
kronican.cpp:44:19: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
  qt = min(n - k, 0);
                   ^
In file included from /usr/include/c++/7/bits/char_traits.h:39:0,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/istream:38,
                 from /usr/include/c++/7/sstream:38,
                 from /usr/include/c++/7/complex:45,
                 from /usr/include/c++/7/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
                 from kronican.cpp:1:
/usr/include/c++/7/bits/stl_algobase.h:243:5: note: candidate: template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)
     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^~~
/usr/include/c++/7/bits/stl_algobase.h:243:5: note:   template argument deduction/substitution failed:
kronican.cpp:44:19: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
  qt = min(n - k, 0);
                   ^
In file included from /usr/include/c++/7/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from kronican.cpp:1:
/usr/include/c++/7/bits/stl_algo.h:3450:5: note: candidate: template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)
     min(initializer_list<_Tp> __l)
     ^~~
/usr/include/c++/7/bits/stl_algo.h:3450:5: note:   template argument deduction/substitution failed:
kronican.cpp:44:19: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
  qt = min(n - k, 0);
                   ^
In file included from /usr/include/c++/7/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from kronican.cpp:1:
/usr/include/c++/7/bits/stl_algo.h:3456:5: note: candidate: template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)
     min(initializer_list<_Tp> __l, _Compare __comp)
     ^~~
/usr/include/c++/7/bits/stl_algo.h:3456:5: note:   template argument deduction/substitution failed:
kronican.cpp:44:19: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
  qt = min(n - k, 0);
                   ^