結果

問題 No.79 過小評価ダメ・ゼッタイ
コンテスト
ユーザー バカらっく
提出日時 2019-09-25 21:26:37
言語 Kotlin
(2.3.20)
コンパイル:
kotlinc _filename_ -include-runtime -d main.jar
実行:
kotlin main.jar
結果
AC  
実行時間 353 ms / 5,000 ms
コード長 341 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 9,949 ms
コンパイル使用メモリ 468,508 KB
実行使用メモリ 64,252 KB
最終ジャッジ日時 2026-04-10 22:35:03
合計ジャッジ時間 18,473 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:4:85: warning: unnecessary non-null assertion (!!) on a non-null receiver of type 'Map.Entry<Int, Int>'.
    val ans = countMap.maxBy { it.value }.let {a -> countMap.filter { it.value ==  a!!.value} }.maxBy { it.key }!!.key
                                                                                    ^^
Main.kt:4:113: warning: unnecessary non-null assertion (!!) on a non-null receiver of type 'Map.Entry<Int, Int>'.
    val ans = countMap.maxBy { it.value }.let {a -> countMap.filter { it.value ==  a!!.value} }.maxBy { it.key }!!.key
                                                                                                                ^^

ソースコード

diff #
raw source code

fun main(args:Array<String>) {
    val answerCount = readLine()!!.toInt()
    val countMap = readLine()!!.split(" ").map { it.toInt() }.let { a-> a.toSet().map {b-> b to a.count { b == it } } }.toMap()
    val ans = countMap.maxBy { it.value }.let {a -> countMap.filter { it.value ==  a!!.value} }.maxBy { it.key }!!.key
    println(ans)
}

0