結果
| 問題 | No.216 FAC |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-06-06 20:52:35 |
| 言語 | Kotlin (2.1.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 523 bytes |
| 記録 | |
| コンパイル時間 | 15,438 ms |
| コンパイル使用メモリ | 449,788 KB |
| 実行使用メモリ | 57,296 KB |
| 最終ジャッジ日時 | 2024-11-20 18:44:22 |
| 合計ジャッジ時間 | 22,960 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 23 WA * 1 |
コンパイルメッセージ
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 }
^
ソースコード
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)
}