結果

問題 No.9 モンスターのレベル上げ
ユーザー gigurururugigurururu
提出日時 2015-01-06 02:24:57
言語 Scala(Beta)
(3.4.0)
結果
AC  
実行時間 2,853 ms / 5,000 ms
コード長 634 bytes
コンパイル時間 12,199 ms
コンパイル使用メモリ 265,916 KB
実行使用メモリ 64,276 KB
最終ジャッジ日時 2023-09-11 07:35:24
合計ジャッジ時間 51,202 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,010 ms
62,968 KB
testcase_01 AC 1,008 ms
63,020 KB
testcase_02 AC 2,853 ms
63,840 KB
testcase_03 AC 2,507 ms
64,032 KB
testcase_04 AC 1,928 ms
63,576 KB
testcase_05 AC 1,717 ms
63,636 KB
testcase_06 AC 1,425 ms
63,836 KB
testcase_07 AC 1,110 ms
63,220 KB
testcase_08 AC 1,476 ms
63,448 KB
testcase_09 AC 2,812 ms
63,888 KB
testcase_10 AC 1,008 ms
62,752 KB
testcase_11 AC 2,515 ms
63,828 KB
testcase_12 AC 2,751 ms
63,668 KB
testcase_13 AC 2,749 ms
64,276 KB
testcase_14 AC 2,773 ms
63,596 KB
testcase_15 AC 2,619 ms
63,600 KB
testcase_16 AC 1,240 ms
63,340 KB
testcase_17 AC 2,152 ms
63,856 KB
testcase_18 AC 2,031 ms
63,776 KB
testcase_19 AC 1,229 ms
63,300 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import scala.collection.mutable
import scala.io.StdIn

object Main {
  def main(args:Array[String]) = {
    val n = StdIn.readInt()
    val a = StdIn.readLine().split(" ").map(_.toInt).+:(1000000000)
    val pq = new mutable.PriorityQueue[(Int,Int)]()(Ordering.Tuple2[Int,Int].reverse)
    for (v <- a) pq.+=((v,0))
    val b = StdIn.readLine().split(" ").map(_.toInt/2)
    println( (0 until n).map { i =>
      val q = pq.clone()
      val (h:Array[Int], t:Array[Int]) = b.splitAt(i).swap
      h.++(t).foreach { j =>
        val (l, c) = q.dequeue()
        q.enqueue((l + j, c + 1))
      }
      q.map(_._2).max
    }.min )
  }
}
0