結果

問題 No.9 モンスターのレベル上げ
ユーザー バカらっくバカらっく
提出日時 2019-08-30 12:58:54
言語 Kotlin
(1.9.23)
結果
WA  
実行時間 -
コード長 905 bytes
コンパイル時間 15,656 ms
コンパイル使用メモリ 445,012 KB
実行使用メモリ 91,360 KB
最終ジャッジ日時 2024-04-30 22:46:22
合計ジャッジ時間 28,728 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 331 ms
57,204 KB
testcase_01 AC 332 ms
56,960 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 329 ms
57,104 KB
testcase_11 AC 1,113 ms
91,016 KB
testcase_12 AC 1,060 ms
90,952 KB
testcase_13 AC 874 ms
91,136 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:3:10: warning: parameter 'arr' is never used
fun main(arr:Array<String>) {
         ^

ソースコード

diff #

import java.util.*

fun main(arr:Array<String>) {
    val count = readLine()!!.toInt()
    var ans = count
    val mikataLevel = readLine()!!.split(" ").map { it.toInt() }
    val teki = readLine()!!.split(" ").map { it.toInt() }
    for(i in mikataLevel.indices) {
        val que = PriorityQueue<Mikata>(kotlin.Comparator { o1, o2 -> if(o1.level == o2.level) o1.count.compareTo(o2.count) else o1.level.compareTo(o2.level) })
        mikataLevel.forEach{que.add(Mikata(it, 0))}
        for(j in mikataLevel.indices) {
            val idx = (i+j)%count
            val mikata = que.poll()
            mikata.level += teki[idx]/2
            mikata.count++
            if(mikata.count > ans) {
                break
            }
            que.add(mikata)
        }
        ans = Math.min(ans, que.toList().maxBy { it.count }!!.count)
    }
    println(ans)
}

class Mikata(var level:Int, var count:Int)
0