結果

問題 No.216 FAC
ユーザー komkomhkomkomh
提出日時 2019-06-06 20:52:35
言語 Kotlin
(1.9.23)
結果
WA  
実行時間 -
コード長 523 bytes
コンパイル時間 14,892 ms
コンパイル使用メモリ 421,808 KB
実行使用メモリ 53,564 KB
最終ジャッジ日時 2023-08-13 02:24:31
合計ジャッジ時間 23,340 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 295 ms
53,116 KB
testcase_01 AC 297 ms
53,180 KB
testcase_02 AC 299 ms
53,168 KB
testcase_03 AC 307 ms
53,052 KB
testcase_04 AC 303 ms
52,928 KB
testcase_05 AC 306 ms
52,996 KB
testcase_06 AC 295 ms
53,132 KB
testcase_07 AC 295 ms
53,076 KB
testcase_08 AC 298 ms
53,132 KB
testcase_09 AC 297 ms
52,960 KB
testcase_10 AC 300 ms
52,888 KB
testcase_11 AC 301 ms
52,948 KB
testcase_12 AC 293 ms
53,344 KB
testcase_13 AC 298 ms
52,908 KB
testcase_14 AC 295 ms
53,196 KB
testcase_15 AC 300 ms
52,916 KB
testcase_16 AC 310 ms
53,148 KB
testcase_17 AC 306 ms
53,180 KB
testcase_18 AC 305 ms
52,920 KB
testcase_19 AC 304 ms
53,124 KB
testcase_20 AC 305 ms
53,564 KB
testcase_21 AC 304 ms
53,068 KB
testcase_22 AC 305 ms
53,024 KB
testcase_23 AC 306 ms
53,168 KB
testcase_24 AC 305 ms
53,064 KB
testcase_25 AC 307 ms
53,288 KB
testcase_26 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:11:38: warning: 'sumBy((T) -> Int): Int' is deprecated. Use sumOf instead.
        .map { Pair(it.key, it.value.sumBy { pair -> pair.second }) }
                                     ^
Main.kt:12:29: warning: unnecessary safe call on a non-null receiver of type Pair<Int, Int>
        .maxBy { it.second }?.let { it.first } ?: run { 0 }
                            ^
Main.kt:12:48: warning: elvis operator (?:) always returns the left operand of non-nullable type Int
        .maxBy { it.second }?.let { it.first } ?: run { 0 }
                                               ^

ソースコード

diff #

package yukicoder

fun main() {
    val N = readLine()!!.toInt()
    val A = readLine()!!.split(" ").map(String::toInt)
    val B = readLine()!!.split(" ").map(String::toInt)

    val maxScoreUser: Int = (0 until N)
        .map { Pair(B[it], A[it]) }
        .groupBy { it.first }
        .map { Pair(it.key, it.value.sumBy { pair -> pair.second }) }
        .maxBy { it.second }?.let { it.first } ?: run { 0 }

    val ans = when (maxScoreUser == 0) {
        true -> "YES"
        false -> "NO"
    }
    println(ans)
}
0