Submission #954997


Source Code Expand

fun main(args: Array<String>) {
    val (n, x) = readLine()!!.split(' ').map(String::toInt)
    if (x == 1 || x == 2 * n - 1) {
        println("No")
        return
    }
    if (n == 2) {
        println("Yes")
        println("1 2 3")
        return
    }
    val ans = IntArray(2 * n - 1)
    val range : IntRange
    if (x == 2 * n - 2) {
        ans[n - 2] = x - 1
        ans[n - 1] = x + 1
        ans[n] = x
        ans[n + 1] = x - 2
        range = IntRange(x - 2, x + 1)
    } else {
        ans[n - 2] = x + 1
        ans[n - 1] = x - 1
        ans[n] = x
        ans[n + 1] = x + 2
        range = IntRange(x - 1, x + 2)
    }
    var j = 1
    for (i in ans.indices) {
        if (ans[i] == 0) {
            while (j in range) j++
            ans[i] = j++
        }
    }
    println("Yes")
    ans.forEach { println(it) }
}

Submission Info

Submission Time
Task B - Median Pyramid Easy
User AlexeyEnkov
Language Kotlin (1.0.0)
Score 0
Code Size 875 Byte
Status TLE
Exec Time 2102 ms
Memory 29152 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 400
Status
AC × 2
AC × 16
TLE × 6
Set Name Test Cases
Sample 0_00.txt, 0_01.txt
All 0_00.txt, 0_01.txt, 1_00.txt, 1_01.txt, 1_02.txt, 1_03.txt, 1_04.txt, 1_05.txt, 1_06.txt, 1_07.txt, 1_08.txt, 1_09.txt, 1_10.txt, 1_11.txt, 1_12.txt, 1_13.txt, 1_14.txt, 1_15.txt, 1_16.txt, 1_17.txt, 1_18.txt, 1_19.txt
Case Name Status Exec Time Memory
0_00.txt AC 293 ms 22272 KB
0_01.txt AC 281 ms 22188 KB
1_00.txt AC 280 ms 22196 KB
1_01.txt AC 282 ms 22404 KB
1_02.txt AC 281 ms 22184 KB
1_03.txt AC 282 ms 22392 KB
1_04.txt AC 282 ms 22408 KB
1_05.txt AC 281 ms 22316 KB
1_06.txt AC 282 ms 22316 KB
1_07.txt AC 280 ms 22324 KB
1_08.txt AC 280 ms 22268 KB
1_09.txt TLE 2102 ms 28840 KB
1_10.txt TLE 2102 ms 28824 KB
1_11.txt TLE 2102 ms 29152 KB
1_12.txt TLE 2102 ms 29044 KB
1_13.txt TLE 2102 ms 29076 KB
1_14.txt AC 293 ms 22188 KB
1_15.txt AC 282 ms 22392 KB
1_16.txt AC 1650 ms 28360 KB
1_17.txt TLE 2102 ms 29032 KB
1_18.txt AC 1306 ms 27908 KB
1_19.txt AC 281 ms 22312 KB