結果

問題 No.706 多眼生物の調査
ユーザー 💕💖💞💕💖💞
提出日時 2018-07-22 00:38:50
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 579 ms / 2,000 ms
コード長 322 bytes
コンパイル時間 13,258 ms
コンパイル使用メモリ 423,008 KB
実行使用メモリ 60,648 KB
最終ジャッジ日時 2023-08-13 00:10:02
合計ジャッジ時間 17,439 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 305 ms
52,856 KB
testcase_01 AC 303 ms
52,848 KB
testcase_02 AC 305 ms
52,948 KB
testcase_03 AC 339 ms
53,104 KB
testcase_04 AC 369 ms
53,296 KB
testcase_05 AC 519 ms
59,516 KB
testcase_06 AC 579 ms
60,648 KB
testcase_07 AC 309 ms
53,232 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:1:10: warning: parameter 'args' is never used
fun main(args:Array<String>) {
         ^
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:26: warning: destructured parameter 'k' is never used
  val res = dd.filter { (k,size) -> size == maxSec }.map { (k, size) -> k }.max()!!
                         ^
Main.kt:4:64: warning: destructured parameter 'size' is never used
  val res = dd.filter { (k,size) -> size == maxSec }.map { (k, size) -> k }.max()!!
                                                               ^
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 #

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