結果

問題 No.647 明太子
コンテスト
ユーザー 💕💖💞
提出日時 2018-02-15 22:02:27
言語 Kotlin
(2.4.10 + ACL)
コンパイル:
kotlinc -cp /opt/aclib/ac_library.jar _filename_ -include-runtime -d main.jar
実行:
java -cp main.jar:/opt/aclib/ac_library.jar _class_
結果
AC  
実行時間 385 ms / 4,500 ms
+ 904µs
コード長 763 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 8,354 ms
コンパイル使用メモリ 520,180 KB
実行使用メモリ 54,248 KB
最終ジャッジ日時 2026-09-27 01:21:08
合計ジャッジ時間 14,511 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge4_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

fun main(args:Array<String>) { 
  val persons = (1..readLine()!!.toInt()).map { 
    val p = readLine()!!.split(" ").map{ it.toInt() }
    Pair(p[0], p[1])
  }
  val mentais = (1..readLine()!!.toInt()).map { 
    val p = readLine()!!.split(" ").map{ it.toInt() }
    Pair(p[0], p[1])
  }

  // first 値段
  // second からさ
  val pairs = mentais.mapIndexed { i,mentai ->
    val score = persons.map { person ->
      when {
        mentai.first <= person.first && person.second <= mentai.second -> 1
        else -> 0
      }
    }.sum()
    Pair(i+1, score)
  }
  val max = pairs.maxBy { it.second }!!.second

  when { 
    max == 0 -> { println(0) }
    else -> {
      pairs.filter { it.second == max }.map { 
        println(it.first)
      }
    }
  }
}
0