結果
| 問題 |
No.2056 非力なレッド
|
| コンテスト | |
| ユーザー |
rhincodon66
|
| 提出日時 | 2022-08-26 21:30:46 |
| 言語 | Kotlin (2.1.0) |
| 結果 |
AC
|
| 実行時間 | 599 ms / 2,000 ms |
| コード長 | 774 bytes |
| コンパイル時間 | 12,483 ms |
| コンパイル使用メモリ | 435,636 KB |
| 実行使用メモリ | 96,816 KB |
| 最終ジャッジ日時 | 2024-10-13 21:56:55 |
| 合計ジャッジ時間 | 32,310 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 38 |
コンパイルメッセージ
Main.kt:6:10: warning: parameter 'args' is never used
fun main(args:Array<String>) {
^
ソースコード
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