답안 #98501

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
98501 2019-02-23T19:20:25 Z pamaj Kronican (COCI16_kronican) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
const int maxn = 20;
#define int uint_fast32_t
 
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 'uint_fast32_t solve(uint_fast32_t)':
kronican.cpp:15:14: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  if(dp[mask] != -1) return dp[mask];
     ~~~~~~~~~^~~~~
kronican.cpp: In function 'int32_t main()':
kronican.cpp:44:19: error: no matching function for call to 'min(uint_fast32_t, 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 unsigned 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 unsigned 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 unsigned 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 unsigned int'
  qt = min(n - k, 0);
                   ^