結果

問題 No.3009 異なる数字の最大の範囲(勉強会用)
ユーザー Pump0129Pump0129
提出日時 2018-08-21 16:16:37
言語 Kotlin
(1.9.23)
結果
WA  
実行時間 -
コード長 602 bytes
コンパイル時間 15,390 ms
コンパイル使用メモリ 418,344 KB
実行使用メモリ 63,884 KB
最終ジャッジ日時 2023-09-03 16:58:17
合計ジャッジ時間 26,651 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 295 ms
52,696 KB
testcase_01 AC 294 ms
52,704 KB
testcase_02 AC 293 ms
52,752 KB
testcase_03 AC 294 ms
52,684 KB
testcase_04 AC 290 ms
52,764 KB
testcase_05 AC 289 ms
53,100 KB
testcase_06 AC 295 ms
52,840 KB
testcase_07 AC 290 ms
52,836 KB
testcase_08 AC 290 ms
52,768 KB
testcase_09 AC 292 ms
52,744 KB
testcase_10 AC 299 ms
52,940 KB
testcase_11 AC 302 ms
52,940 KB
testcase_12 AC 292 ms
52,664 KB
testcase_13 AC 294 ms
52,744 KB
testcase_14 AC 297 ms
52,548 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 474 ms
57,592 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 553 ms
59,900 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:5:10: warning: parameter 'args' is never used
fun main(args: Array<String>) {
         ^

ソースコード

diff #

package net.ipipip0129.kotlin.yukicoder

import kotlin.math.max

fun main(args: Array<String>) {
    val num = readLine()!!.toInt()
    val numList = readLine()!!.split(" ").map { it.toInt() }
    val numMap = mutableMapOf<Int, Int>()
    var i = 0
    var ans = 0
    while (i < num) {
        if (numMap.containsKey(numList[i])) {
            ans = numMap.size
            i = numMap[numList[i]]!! + 1
            numMap.clear()
            numMap[numList[i]] = i
        } else {
            numMap[numList[i]] = i
        }
        i++
    }
    print(max(ans, numMap.size))
}
0