結果

問題 No.1380 Borderline
ユーザー 👑 yumechiyumechi
提出日時 2021-03-03 00:08:28
言語 Scala(Beta)
(3.3.1)
結果
AC  
実行時間 1,062 ms / 2,000 ms
コード長 455 bytes
コンパイル時間 9,525 ms
コンパイル使用メモリ 265,568 KB
実行使用メモリ 64,140 KB
最終ジャッジ日時 2023-07-26 15:13:36
合計ジャッジ時間 58,453 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 995 ms
63,384 KB
testcase_01 AC 1,009 ms
63,620 KB
testcase_02 AC 1,006 ms
63,392 KB
testcase_03 AC 995 ms
63,384 KB
testcase_04 AC 1,011 ms
63,512 KB
testcase_05 AC 1,016 ms
63,416 KB
testcase_06 AC 981 ms
63,552 KB
testcase_07 AC 995 ms
63,532 KB
testcase_08 AC 1,011 ms
63,476 KB
testcase_09 AC 1,010 ms
63,592 KB
testcase_10 AC 1,005 ms
63,360 KB
testcase_11 AC 1,008 ms
63,668 KB
testcase_12 AC 998 ms
63,572 KB
testcase_13 AC 1,011 ms
63,488 KB
testcase_14 AC 1,022 ms
63,460 KB
testcase_15 AC 1,033 ms
63,700 KB
testcase_16 AC 1,029 ms
63,744 KB
testcase_17 AC 1,022 ms
63,692 KB
testcase_18 AC 1,042 ms
63,560 KB
testcase_19 AC 1,025 ms
63,668 KB
testcase_20 AC 1,024 ms
63,616 KB
testcase_21 AC 1,048 ms
63,568 KB
testcase_22 AC 1,043 ms
63,580 KB
testcase_23 AC 1,037 ms
63,528 KB
testcase_24 AC 1,062 ms
63,652 KB
testcase_25 AC 1,037 ms
64,140 KB
testcase_26 AC 1,034 ms
63,768 KB
testcase_27 AC 1,020 ms
63,724 KB
testcase_28 AC 1,027 ms
63,536 KB
testcase_29 AC 1,046 ms
64,108 KB
testcase_30 AC 1,028 ms
63,524 KB
testcase_31 AC 1,032 ms
63,624 KB
testcase_32 AC 1,022 ms
63,544 KB
testcase_33 AC 1,043 ms
63,552 KB
testcase_34 AC 1,030 ms
64,088 KB
testcase_35 AC 1,037 ms
63,516 KB
testcase_36 AC 1,034 ms
63,544 KB
testcase_37 AC 1,030 ms
63,724 KB
testcase_38 AC 1,039 ms
63,704 KB
testcase_39 AC 1,021 ms
63,616 KB
testcase_40 AC 1,041 ms
63,580 KB
testcase_41 AC 1,030 ms
63,688 KB
testcase_42 AC 1,042 ms
63,684 KB
testcase_43 AC 1,040 ms
63,656 KB
testcase_44 AC 994 ms
63,548 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner

object Main extends App {
  val sc = new Scanner(System.in)

  def solve(k: Int, pn: Array[Int]): Int = {
    val maxPoint = pn.max + 1
    var tmp = 0
    for(i <- (0 to maxPoint).reverse) {
      val cnt = pn.count(_ >= i)
      if(cnt <= k) {
        tmp = cnt
      } else {
        return tmp
      }
    }
    tmp
  }

  val n = sc.nextInt
  val k = sc.nextInt
  val pn = Array.fill(n)(sc.nextInt)
  println(solve(k, pn))
}
0