結果

問題 No.1463 Hungry Kanten
ユーザー face4face4
提出日時 2021-04-07 14:22:42
言語 Kotlin
(1.9.23)
結果
WA  
実行時間 -
コード長 560 bytes
コンパイル時間 17,261 ms
コンパイル使用メモリ 419,472 KB
実行使用メモリ 80,124 KB
最終ジャッジ日時 2023-09-04 14:50:16
合計ジャッジ時間 29,073 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 302 ms
53,128 KB
testcase_01 AC 301 ms
52,792 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 1,305 ms
80,124 KB
testcase_06 AC 306 ms
52,808 KB
testcase_07 AC 309 ms
53,040 KB
testcase_08 AC 303 ms
52,888 KB
testcase_09 AC 302 ms
52,892 KB
testcase_10 AC 312 ms
52,896 KB
testcase_11 AC 328 ms
53,132 KB
testcase_12 AC 345 ms
53,268 KB
testcase_13 AC 339 ms
53,224 KB
testcase_14 AC 451 ms
60,364 KB
testcase_15 AC 439 ms
59,344 KB
testcase_16 AC 472 ms
59,808 KB
testcase_17 AC 557 ms
63,340 KB
testcase_18 AC 451 ms
57,808 KB
testcase_19 AC 695 ms
68,352 KB
testcase_20 AC 825 ms
69,468 KB
testcase_21 AC 325 ms
52,952 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

fun main(){
    val (n, k) = readLine()!!.split(" ").map{it.toInt()}
    val a = readLine()!!.split(" ").map{it.toLong()}

    val ints = mutableSetOf<Long>()
    for(i in 1..(1 shl n)){
        val indexes = mutableSetOf<Int>()
        for(j in 0..n-1){
            if(((i shr j) and 1) == 1)   indexes.add(j)
        }
        if(indexes.size < k)  continue
        ints.add(a.filterIndexed{index,  _ -> indexes.contains(index)}.reduce{s, t -> s*t})
        ints.add(a.filterIndexed{index, _ -> indexes.contains(index)}.sum())
    }

    println(ints.size)
}
0