結果
| 問題 | No.2056 非力なレッド |
| コンテスト | |
| ユーザー |
rhincodon66
|
| 提出日時 | 2022-08-26 21:30:46 |
| 言語 | Kotlin (2.3.20) |
| 結果 |
AC
|
| 実行時間 | 598 ms / 2,000 ms |
| コード長 | 774 bytes |
| 記録 | |
| コンパイル時間 | 12,185 ms |
| コンパイル使用メモリ | 475,132 KB |
| 実行使用メモリ | 81,552 KB |
| 最終ジャッジ日時 | 2026-05-01 08:53:00 |
| 合計ジャッジ時間 | 27,653 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 38 |
ソースコード
import java.lang.StringBuilder
import java.util.*
import kotlin.collections.ArrayList
import kotlin.math.*
fun main(args:Array<String>) {
/*
val t = readLine()!!.toInt()
repeat(t) {
solve()
}
*/
solve()
}
fun solve() {
val (n, x, m) = readLine()!!.split(" ").map{it.toInt()}.toIntArray()
val a = readLine()!!.split(" ").map{it.toInt()}.toIntArray()
val cnt = IntArray(n)
for (i in 0 until n) {
while (a[i] >= x) {
a[i] /= 2
cnt[i]++
}
}
var sum = 0L
var mcnt = 0
for (i in n - 1 downTo 0) {
val cost = cnt[i] - mcnt
if (cost > 0) {
mcnt += cost
sum += (i + 1) * cost
}
}
println(if (sum <= m) "Yes" else "No")
}
rhincodon66