結果
| 問題 | No.216 FAC |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-06-06 20:52:35 |
| 言語 | Kotlin (2.3.20) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 523 bytes |
| 記録 | |
| コンパイル時間 | 10,225 ms |
| コンパイル使用メモリ | 480,148 KB |
| 実行使用メモリ | 53,460 KB |
| 最終ジャッジ日時 | 2026-05-14 22:10:36 |
| 合計ジャッジ時間 | 15,864 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 23 WA * 1 |
コンパイルメッセージ
Main.kt:11:38: warning: 'fun <T> Iterable<T>.sumBy(selector: (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 }
^^
ソースコード
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)
}