結果

問題 No.1463 Hungry Kanten
ユーザー kokatsukokatsu
提出日時 2021-11-10 21:14:02
言語 D
(dmd 2.106.1)
結果
AC  
実行時間 1,094 ms / 2,000 ms
コード長 489 bytes
コンパイル時間 2,340 ms
コンパイル使用メモリ 210,564 KB
実行使用メモリ 67,936 KB
最終ジャッジ日時 2023-09-04 14:52:25
合計ジャッジ時間 7,004 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,384 KB
testcase_02 AC 38 ms
9,616 KB
testcase_03 AC 915 ms
4,384 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1,094 ms
67,936 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,384 KB
testcase_08 AC 1 ms
4,384 KB
testcase_09 AC 1 ms
4,384 KB
testcase_10 AC 2 ms
4,384 KB
testcase_11 AC 3 ms
4,380 KB
testcase_12 AC 4 ms
4,380 KB
testcase_13 AC 2 ms
4,384 KB
testcase_14 AC 12 ms
4,604 KB
testcase_15 AC 3 ms
4,384 KB
testcase_16 AC 38 ms
8,088 KB
testcase_17 AC 115 ms
14,512 KB
testcase_18 AC 36 ms
8,340 KB
testcase_19 AC 508 ms
53,324 KB
testcase_20 AC 728 ms
56,372 KB
testcase_21 AC 3 ms
4,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import std;
import core.bitop;

void main() {
    int N, K;
    readf("%d %d\n", N, K);

    auto A = readln.chomp.split.to!(BigInt[]);

    bool[BigInt] list;
    foreach (i; 0 .. 2^^N) {
        if (i.popcnt < K) {
            continue;
        }

        BigInt S, M = 1;
        foreach (j; 0 .. N) {
            if ((i >> j) & 1) {
                S += A[j];
                M *= A[j];
            }
        }

        list[S] = true, list[M] = true;
    }

    list.length.writeln;
}
0