結果

問題 No.79 過小評価ダメ・ゼッタイ
ユーザー バカらっくバカらっく
提出日時 2019-09-25 21:26:37
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 592 ms / 5,000 ms
コード長 341 bytes
コンパイル時間 14,822 ms
コンパイル使用メモリ 439,944 KB
実行使用メモリ 60,264 KB
最終ジャッジ日時 2023-10-23 22:48:19
合計ジャッジ時間 27,491 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 361 ms
54,868 KB
testcase_01 AC 592 ms
60,264 KB
testcase_02 AC 323 ms
54,616 KB
testcase_03 AC 320 ms
54,616 KB
testcase_04 AC 321 ms
54,620 KB
testcase_05 AC 559 ms
60,132 KB
testcase_06 AC 321 ms
54,652 KB
testcase_07 AC 323 ms
54,644 KB
testcase_08 AC 320 ms
54,632 KB
testcase_09 AC 318 ms
54,628 KB
testcase_10 AC 322 ms
54,624 KB
testcase_11 AC 318 ms
54,628 KB
testcase_12 AC 319 ms
54,620 KB
testcase_13 AC 321 ms
54,628 KB
testcase_14 AC 569 ms
60,108 KB
testcase_15 AC 483 ms
58,432 KB
testcase_16 AC 574 ms
60,200 KB
testcase_17 AC 486 ms
58,448 KB
testcase_18 AC 577 ms
60,160 KB
testcase_19 AC 556 ms
60,096 KB
testcase_20 AC 576 ms
60,180 KB
testcase_21 AC 351 ms
54,804 KB
testcase_22 AC 497 ms
58,444 KB
testcase_23 AC 572 ms
60,184 KB
testcase_24 AC 586 ms
60,224 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:1:10: warning: parameter 'args' is never used
fun main(args:Array<String>) {
         ^
Main.kt:2:9: warning: variable 'answerCount' is never used
    val answerCount = readLine()!!.toInt()
        ^
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 #

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