結果

問題 No.519 アイドルユニット
ユーザー nebukuro09nebukuro09
提出日時 2017-06-10 14:49:34
言語 D
(dmd 2.106.1)
結果
TLE  
実行時間 -
コード長 732 bytes
コンパイル時間 912 ms
コンパイル使用メモリ 105,724 KB
実行使用メモリ 69,932 KB
最終ジャッジ日時 2023-09-03 14:12:44
合計ジャッジ時間 14,069 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 TLE -
testcase_02 AC 385 ms
20,000 KB
testcase_03 AC 23 ms
4,388 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 3 ms
4,380 KB
testcase_10 AC 6 ms
4,380 KB
testcase_11 AC 23 ms
5,412 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 21 ms
4,380 KB
testcase_14 AC 22 ms
4,376 KB
testcase_15 AC 22 ms
4,380 KB
testcase_16 AC 22 ms
4,384 KB
testcase_17 AC 23 ms
4,384 KB
testcase_18 AC 22 ms
4,380 KB
testcase_19 AC 21 ms
4,380 KB
testcase_20 AC 22 ms
4,380 KB
testcase_21 AC 22 ms
4,888 KB
testcase_22 AC 23 ms
4,384 KB
testcase_23 AC 23 ms
4,376 KB
testcase_24 AC 89 ms
7,164 KB
testcase_25 AC 90 ms
7,532 KB
testcase_26 AC 88 ms
6,968 KB
testcase_27 AC 90 ms
7,684 KB
testcase_28 AC 88 ms
7,496 KB
testcase_29 TLE -
testcase_30 TLE -
testcase_31 TLE -
testcase_32 TLE -
testcase_33 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.stdio;

immutable int INF = 1 << 28;

void main() {
    auto N = readln.chomp.to!int;
    auto F = N.iota.map!(_ => readln.split.map!(to!int).array).array;

    auto dp = new int[](1 << N);

    foreach (mask; 0..(1 << N)) {
        int i = bsf(~mask);
        foreach (j; i+1..N) {
            if (!(mask & (1 << j))) {
                dp[mask | (1 << i) | (1 << j)] = max(dp[mask | (1 << i) | (1 << j)],
                                                     dp[mask] + F[i][j]);
            }
        }
    }

    dp[(1 << N) - 1].writeln;
}
0