結果
| 問題 |
No.1470 Mex Sum
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-04-10 14:05:30 |
| 言語 | Kotlin (2.1.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 348 bytes |
| コンパイル時間 | 13,507 ms |
| コンパイル使用メモリ | 430,464 KB |
| 実行使用メモリ | 80,340 KB |
| 最終ジャッジ日時 | 2024-06-26 03:33:17 |
| 合計ジャッジ時間 | 42,716 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 10 WA * 39 |
コンパイルメッセージ
Main.kt:2:9: warning: variable 'n' is never used
val n = readLine()!!.toInt()
^
ソースコード
fun main() {
val n = readLine()!!.toInt()
val a = readLine()!!.split(" ").map { it.toInt() }
var one = 0
var two = 0
var others = 0
println(a.map{
when(it){
1 -> 2*one++ + 3*two + 2*others
2 -> 3*one + 1*two++ + 1*others
else -> 2*one + 1*two + 1*others++
}
}.sum())
}