Submission #42154315


Source Code Expand

fun main() {
    val (h, w) = readLine()!!.split(" ").map { it.toInt() }
    val s = List(h) {
        readLine()!!
    }

    var c = 0
    var min = Int.MAX_VALUE

    for(i in 0 until h) {
        if(s[i].indexOf("#") < 0) {
            continue
        }

        val count = s[i].count { it == '#' }

        if(count < min) {
            min = count
            c = i
        }
    }

    val start = s[c].indexOf("#")
    val end = s[c].lastIndexOf("#")

    for(i in start..end) {
        if(s[c][i] == '.') {
            println("${c+1} ${i+1}")
            return
        }
    }

    val diff = if(c == 0) {
        1
    } else {
        -1
    }

    if(start == 0) {
        println("${c+1} ${end+2}")
        return
    }

    if(s[c + diff][start - 1] == '#') {
        println("${c+1} $start")
        return
    }

    println("${c+1} ${end+2}")
}

Submission Info

Submission Time
Task C - Snuke the Cookie Picker
User dhirabayashi
Language Kotlin (1.3.71)
Score 0
Code Size 916 Byte
Status WA
Exec Time 232 ms
Memory 43872 KiB

Compile Error

warning: ATTENTION!
This build uses unsafe internal compiler arguments:

-XXLanguage:+InlineClasses

This mode is not recommended for production use,
as no stability/compatibility guarantees are given on
compiler or generated code. Use it at your own risk!

Main.kt:2:13: warning: variable 'w' is never used
    val (h, w) = readLine()!!.split(" ").map { it.toInt() }
            ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 3
AC × 21
WA × 2
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_handmade_00.txt, 01_handmade_01.txt, 01_handmade_02.txt, 01_handmade_03.txt, 02_random_00.txt, 02_random_01.txt, 02_random_02.txt, 02_random_03.txt, 02_random_04.txt, 02_random_05.txt, 02_random_06.txt, 02_random_07.txt, 03_corner_00.txt, 03_corner_01.txt, 03_corner_02.txt, 03_corner_03.txt, 03_corner_04.txt, 03_corner_05.txt, 03_corner_06.txt, 03_corner_07.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 99 ms 36396 KiB
00_sample_01.txt AC 99 ms 36156 KiB
00_sample_02.txt AC 101 ms 36264 KiB
01_handmade_00.txt WA 203 ms 40260 KiB
01_handmade_01.txt AC 205 ms 39820 KiB
01_handmade_02.txt AC 197 ms 39972 KiB
01_handmade_03.txt AC 100 ms 36368 KiB
02_random_00.txt AC 163 ms 38532 KiB
02_random_01.txt AC 177 ms 38456 KiB
02_random_02.txt AC 221 ms 42756 KiB
02_random_03.txt AC 225 ms 40700 KiB
02_random_04.txt AC 167 ms 38532 KiB
02_random_05.txt AC 181 ms 38672 KiB
02_random_06.txt AC 201 ms 40076 KiB
02_random_07.txt AC 227 ms 43872 KiB
03_corner_00.txt AC 232 ms 43432 KiB
03_corner_01.txt AC 225 ms 41036 KiB
03_corner_02.txt AC 214 ms 42400 KiB
03_corner_03.txt WA 227 ms 42628 KiB
03_corner_04.txt AC 226 ms 42876 KiB
03_corner_05.txt AC 222 ms 42840 KiB
03_corner_06.txt AC 227 ms 42284 KiB
03_corner_07.txt AC 230 ms 43292 KiB