結果

問題 No.2153 何コーダーが何人?
ユーザー 👑 箱星箱星
提出日時 2022-12-09 21:22:56
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 425 ms / 2,000 ms
コード長 1,034 bytes
コンパイル時間 19,305 ms
コンパイル使用メモリ 442,804 KB
実行使用メモリ 53,360 KB
最終ジャッジ日時 2024-04-22 19:25:47
合計ジャッジ時間 24,374 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 319 ms
52,352 KB
testcase_01 AC 338 ms
52,636 KB
testcase_02 AC 346 ms
52,560 KB
testcase_03 AC 425 ms
53,180 KB
testcase_04 AC 382 ms
53,000 KB
testcase_05 AC 372 ms
53,208 KB
testcase_06 AC 381 ms
53,172 KB
testcase_07 AC 381 ms
53,172 KB
testcase_08 AC 372 ms
52,584 KB
testcase_09 AC 390 ms
53,128 KB
testcase_10 AC 343 ms
52,620 KB
testcase_11 AC 379 ms
53,360 KB
testcase_12 AC 365 ms
52,736 KB
testcase_13 AC 398 ms
53,212 KB
testcase_14 AC 353 ms
52,556 KB
testcase_15 AC 337 ms
52,484 KB
testcase_16 AC 376 ms
53,156 KB
testcase_17 AC 411 ms
52,932 KB
testcase_18 AC 383 ms
53,172 KB
testcase_19 AC 331 ms
52,116 KB
testcase_20 AC 318 ms
52,140 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.PrintWriter
import java.util.*
import kotlin.math.*

fun PrintWriter.solve() {
    val map = mutableMapOf<String, Int>()
    val n = nextInt()
    for (i in 0 until n) {
        val s = next()
        val c = nextInt()
        map[s] = c
    }
    val ans = (0..7).map { i -> map.values.count { it == i } }
    println(ans.joinToString("\n"))
}

fun main() {
    Thread(null, {
        val writer = PrintWriter(System.out, false)
        writer.solve()
        writer.flush()
    }, "solve", abs(1L.shl(26)))
        .apply { setUncaughtExceptionHandler { _, e -> e.printStackTrace(); kotlin.system.exitProcess(1) } }
        .apply { start() }.join()
}

// region Scanner
private var st = StringTokenizer("")
private val br = System.`in`.bufferedReader()

fun next(): String {
    while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())
    return st.nextToken()
}

fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextLine() = br.readLine()
fun nextDouble() = next().toDouble()
// endregion
0