Submission #71485794


Source Code Expand

fun main() {
    val cin = System.`in`.bufferedReader()
    val cout = System.out.bufferedWriter()

    var n = cin.readLine().toInt()
    var a = cin.readLine().split(" ").map { it.toInt() }

    var ans = 1
    var i = 0
    var max = a[0]-1
    i++
    while (i <= max && i < n) {
        max = maxOf(max, i + a[i] - 1)
        i++
        ans++
    }
    cout.write("${ans}")
    cout.newLine()
    cout.flush()
}

Submission Info

Submission Time
Task C - Domino
User jagbarrameda
Language Kotlin (Kotlin/JVM 2.2.10)
Score 300
Code Size 438 Byte
Status AC
Exec Time 264 ms
Memory 97144 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 20
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
All min.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, sample_01.txt, sample_02.txt, sample_03.txt
Case Name Status Exec Time Memory
min.txt AC 68 ms 42692 KiB
random_01.txt AC 249 ms 96840 KiB
random_02.txt AC 214 ms 70252 KiB
random_03.txt AC 248 ms 96828 KiB
random_04.txt AC 154 ms 55240 KiB
random_05.txt AC 248 ms 96636 KiB
random_06.txt AC 246 ms 96700 KiB
random_07.txt AC 243 ms 96608 KiB
random_08.txt AC 204 ms 68996 KiB
random_09.txt AC 241 ms 96740 KiB
random_10.txt AC 232 ms 82612 KiB
random_11.txt AC 253 ms 96944 KiB
random_12.txt AC 186 ms 69120 KiB
random_13.txt AC 208 ms 86944 KiB
random_14.txt AC 241 ms 96312 KiB
random_15.txt AC 264 ms 96524 KiB
random_16.txt AC 249 ms 97144 KiB
sample_01.txt AC 61 ms 42572 KiB
sample_02.txt AC 59 ms 42440 KiB
sample_03.txt AC 62 ms 42336 KiB