天梯赛-谁去做这个工作
#include
using namespace std;
int t, w[10010][10010], minn = 0x3f3f3f3f;
bool vis[10010];
void dfs(int pos, int ww) {
if(ww>=minn) return;
if (pos == t) {
minn = ww;
return;
}
for (int i = 0; i < t; i++) {
if (vis[i]) continue;
vis[i] = true;
dfs(pos + 1, ww + w[pos][i]);
vis[i] = false;
}
}
int main(void)
{
cin >> t;
for (int i = 0; i < t; i++)
for (int j = 0; j < t; j++)
cin >> w[i][j];
dfs(0, 0);
cout << minn;
return 0;
}