結果

問題 No.519 アイドルユニット
ユーザー TangentDayTangentDay
提出日時 2017-05-28 21:47:14
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 1,043 bytes
コンパイル時間 1,865 ms
コンパイル使用メモリ 83,108 KB
実行使用メモリ 68,708 KB
最終ジャッジ日時 2023-10-21 14:08:11
合計ジャッジ時間 14,742 ms
ジャッジサーバーID
(参考情報)
judge9 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 TLE -
testcase_02 AC 381 ms
19,608 KB
testcase_03 AC 24 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 1 ms
4,348 KB
testcase_06 AC 1 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 3 ms
4,348 KB
testcase_10 AC 7 ms
4,348 KB
testcase_11 AC 24 ms
4,348 KB
testcase_12 AC 1 ms
4,348 KB
testcase_13 AC 24 ms
4,348 KB
testcase_14 AC 24 ms
4,348 KB
testcase_15 AC 24 ms
4,348 KB
testcase_16 AC 24 ms
4,348 KB
testcase_17 AC 24 ms
4,348 KB
testcase_18 AC 24 ms
4,348 KB
testcase_19 AC 24 ms
4,348 KB
testcase_20 AC 24 ms
4,348 KB
testcase_21 AC 24 ms
4,348 KB
testcase_22 AC 24 ms
4,348 KB
testcase_23 AC 24 ms
4,348 KB
testcase_24 AC 93 ms
7,344 KB
testcase_25 AC 93 ms
7,344 KB
testcase_26 AC 94 ms
7,344 KB
testcase_27 AC 94 ms
7,344 KB
testcase_28 AC 93 ms
7,344 KB
testcase_29 TLE -
testcase_30 TLE -
testcase_31 TLE -
testcase_32 TLE -
testcase_33 AC 1 ms
4,348 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:36:13: warning: ‘y’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   36 |         int y;
      |             ^

ソースコード

diff #

#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) c.begin(), c.end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int main(){
    int n;
    int f[24][24];
    cin >> n;
    REP(i,n) REP(j,n) cin >> f[i][j];

    VI dp(1<<n);
    REP(x,1<<n){
        int y;
        REP(i,n){
            if (((x>>i) & 1) == 0){
                y = i;
                break;
            }
        }
        FOR(z,y+1,n-1){
            if ((x >> z) & 1) continue;
            dp[x | (1<<y) | (1<<z)] = max(dp[x | (1<<y) | (1<<z)], dp[x] + f[y][z]);
        }
    }
    cout << dp[(1<<n)-1] << endl;
    return 0;
}
0