結果
| 問題 | No.1463 Hungry Kanten |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-04-07 14:22:42 |
| 言語 | Kotlin (2.3.10) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 560 bytes |
| 記録 | |
| コンパイル時間 | 12,400 ms |
| コンパイル使用メモリ | 461,652 KB |
| 実行使用メモリ | 116,708 KB |
| 最終ジャッジ日時 | 2026-03-06 18:43:33 |
| 合計ジャッジ時間 | 25,646 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 17 WA * 7 |
ソースコード
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)
}