結果

問題 No.216 FAC
ユーザー komkomhkomkomh
提出日時 2019-06-06 20:52:35
言語 Kotlin
(1.9.23)
結果
WA  
実行時間 -
コード長 523 bytes
コンパイル時間 10,512 ms
コンパイル使用メモリ 436,028 KB
実行使用メモリ 57,292 KB
最終ジャッジ日時 2024-04-30 20:52:26
合計ジャッジ時間 19,377 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 270 ms
57,036 KB
testcase_01 AC 269 ms
57,072 KB
testcase_02 AC 271 ms
57,148 KB
testcase_03 AC 282 ms
57,124 KB
testcase_04 AC 273 ms
57,108 KB
testcase_05 AC 272 ms
57,044 KB
testcase_06 AC 268 ms
56,960 KB
testcase_07 AC 265 ms
57,080 KB
testcase_08 AC 268 ms
57,000 KB
testcase_09 AC 267 ms
56,932 KB
testcase_10 AC 270 ms
57,172 KB
testcase_11 AC 270 ms
57,220 KB
testcase_12 AC 272 ms
57,048 KB
testcase_13 AC 274 ms
57,044 KB
testcase_14 AC 268 ms
56,908 KB
testcase_15 AC 265 ms
57,128 KB
testcase_16 AC 277 ms
57,196 KB
testcase_17 AC 274 ms
57,292 KB
testcase_18 AC 273 ms
57,260 KB
testcase_19 AC 279 ms
57,036 KB
testcase_20 AC 281 ms
57,148 KB
testcase_21 AC 287 ms
57,244 KB
testcase_22 AC 287 ms
57,208 KB
testcase_23 AC 298 ms
57,260 KB
testcase_24 AC 301 ms
57,088 KB
testcase_25 AC 276 ms
57,208 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