結果

問題 No.628 Tagの勢い
ユーザー 👑 yumechiyumechi
提出日時 2021-03-04 02:39:13
言語 Scala(Beta)
(3.4.0)
結果
AC  
実行時間 1,338 ms / 2,000 ms
コード長 501 bytes
コンパイル時間 10,939 ms
コンパイル使用メモリ 271,756 KB
実行使用メモリ 72,380 KB
最終ジャッジ日時 2024-04-14 21:57:52
合計ジャッジ時間 32,552 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 979 ms
66,600 KB
testcase_01 AC 988 ms
66,800 KB
testcase_02 AC 967 ms
66,332 KB
testcase_03 AC 1,007 ms
66,776 KB
testcase_04 AC 973 ms
66,296 KB
testcase_05 AC 966 ms
66,236 KB
testcase_06 AC 982 ms
66,668 KB
testcase_07 AC 1,000 ms
66,676 KB
testcase_08 AC 1,023 ms
66,996 KB
testcase_09 AC 1,008 ms
66,924 KB
testcase_10 AC 1,035 ms
67,068 KB
testcase_11 AC 1,006 ms
66,856 KB
testcase_12 AC 1,338 ms
72,380 KB
testcase_13 AC 1,325 ms
72,260 KB
testcase_14 AC 1,323 ms
71,296 KB
testcase_15 AC 1,329 ms
72,196 KB
testcase_16 AC 1,213 ms
67,092 KB
testcase_17 AC 998 ms
66,572 KB
testcase_18 AC 1,001 ms
66,748 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner

object Main extends App {
  val sc = new Scanner(System.in)

  val n = sc.nextInt
  var mp = Map.empty[String, Int]
  for(_ <- 0 until n) {
    val _ = sc.nextInt
    val m = sc.nextInt
    val s = sc.nextInt
    for(t <- Array.fill(m)(sc.next)) {
      val cs = mp.getOrElse(t, 0)
      mp += t -> (cs + s)
    }
  }
  val ta = mp.toSeq
  val arr = ta.sortBy(t => (-t._2, t._1))
  for(i <- 0 until math.min(10, arr.length)) {
    println(s"${arr(i)._1} ${arr(i)._2}")
  }
}
0