結果

問題 No.2056 非力なレッド
コンテスト
ユーザー rhincodon66
提出日時 2022-08-26 21:30:46
言語 Kotlin
(2.3.20)
コンパイル:
kotlinc _filename_ -include-runtime -d main.jar
実行:
kotlin main.jar
結果
AC  
実行時間 598 ms / 2,000 ms
コード長 774 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 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
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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")
}
0