結果

問題 No.1463 Hungry Kanten
ユーザー kokatsukokatsu
提出日時 2021-11-10 21:11:17
言語 D
(dmd 2.106.1)
結果
WA  
実行時間 -
コード長 483 bytes
コンパイル時間 2,446 ms
コンパイル使用メモリ 204,964 KB
実行使用メモリ 20,840 KB
最終ジャッジ日時 2023-09-04 14:51:27
合計ジャッジ時間 3,558 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 72 ms
20,840 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,384 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 4 ms
4,384 KB
testcase_17 AC 10 ms
6,708 KB
testcase_18 AC 4 ms
4,384 KB
testcase_19 AC 37 ms
18,984 KB
testcase_20 AC 43 ms
18,416 KB
testcase_21 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import std;
import core.bitop;

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

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

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

        long 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