結果

問題 No.706 多眼生物の調査
コンテスト
ユーザー 💕💖💞
提出日時 2018-07-22 00:38:50
言語 Kotlin
(2.3.20)
コンパイル:
kotlinc _filename_ -include-runtime -d main.jar
実行:
kotlin main.jar
結果
AC  
実行時間 361 ms / 2,000 ms
コード長 322 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 10,696 ms
コンパイル使用メモリ 472,832 KB
実行使用メモリ 69,820 KB
最終ジャッジ日時 2026-05-14 19:32:36
合計ジャッジ時間 11,259 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 5
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:3:38: warning: unnecessary non-null assertion (!!) on a non-null receiver of type 'Pair<Int, Int>'.
  val maxSec = dd.maxBy { it.second }!!.second
                                     ^^
Main.kt:4:82: warning: unnecessary non-null assertion (!!) on a non-null receiver of type 'Int'.
  val res = dd.filter { (k,size) -> size == maxSec }.map { (k, size) -> k }.max()!!
                                                                                 ^^

ソースコード

diff #
raw source code

fun main(args:Array<String>) {
  val dd = (1..readLine()!!.toInt()).map { readLine()!!.toList().filter { it == '^' }.size }.groupBy { it }.map { (k,vs) -> Pair(k, vs.size) }
  val maxSec = dd.maxBy { it.second }!!.second
  val res = dd.filter { (k,size) -> size == maxSec }.map { (k, size) -> k }.max()!!
  println(res)
}
0