1 条题解

  • 1
    @ 2026-1-16 20:02:47

    包AC

    简简单单的深搜题,我闭着眼睛多能做出来。😝 11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111

    AC code

    11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111

    #include<queue>
    #include<ctime>
    #include<stack>
    #include<cmath>
    #include<math.h>
    #include<cstdio>
    #include<string>
    #include<vector>
    #include<bitset>
    #include<stdio.h>
    #include<climits>
    #include<iomanip>
    #include<algorithm>
    #include<string.h>
    #include<iostream>
    #include<utility>
    #include<cstring>
    #include<fstream>
    #include<cstdlib>
    using namespace std;
    typedef long long ll;
    const int N = 1e5 + 10;
    const int MAXN = 10 + 10;
    const int INF = 0x3f3f3f3f;
    int a[MAXN][MAXN];
    int n , dp[ 1 << MAXN ];
    int main()
    {
    	ios::sync_with_stdio(false);
    	cin.tie(nullptr);
    	cout.tie(nullptr);
    	cin >> n;
    	for ( int i = 0 ; i < n ; ++i )
    	{
    		for ( int j = 0 ; j < n ; ++j )
    		{
    			cin >> a[i][j];
    		}
    	}
    	memset( dp , 0x3f , sizeof(dp) );
    	dp[0] = 0;
    	for ( int i = 0 ; i < (1 << n) ; ++i )
    	{
    		int cnt = __builtin_popcount(i);
    		for ( int j = 0 ; j < n ; ++j )
    		{
    			if ( !( i & ( 1 << j ) ) )
    			{
    				int nk = i | ( 1 << j );
    				dp[nk] = min( dp[nk] , dp[i] + a[cnt][j] );
    			}
    		}
    	}
    	cout << dp[ ( 1 << n ) - 1 ];
    	return 0;
    }
    

    信息

    ID
    1294
    时间
    1000ms
    内存
    256MiB
    难度
    9
    标签
    递交数
    13
    已通过
    4
    上传者