結果

問題 No.179 塗り分け
ユーザー rutilicusrutilicus
提出日時 2020-09-02 21:50:27
言語 Kotlin
(1.9.23)
結果
WA  
実行時間 -
コード長 1,149 bytes
コンパイル時間 16,540 ms
コンパイル使用メモリ 444,512 KB
実行使用メモリ 67,456 KB
最終ジャッジ日時 2024-05-01 16:45:36
合計ジャッジ時間 31,173 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 306 ms
51,552 KB
testcase_01 AC 307 ms
51,548 KB
testcase_02 AC 308 ms
51,540 KB
testcase_03 AC 312 ms
51,464 KB
testcase_04 AC 311 ms
51,620 KB
testcase_05 AC 321 ms
53,324 KB
testcase_06 AC 316 ms
51,548 KB
testcase_07 WA -
testcase_08 AC 349 ms
67,092 KB
testcase_09 WA -
testcase_10 AC 321 ms
51,652 KB
testcase_11 AC 326 ms
51,632 KB
testcase_12 AC 361 ms
64,636 KB
testcase_13 AC 308 ms
51,524 KB
testcase_14 AC 311 ms
51,816 KB
testcase_15 AC 306 ms
51,452 KB
testcase_16 AC 310 ms
51,572 KB
testcase_17 WA -
testcase_18 AC 313 ms
51,936 KB
testcase_19 AC 319 ms
52,040 KB
testcase_20 AC 342 ms
66,168 KB
testcase_21 AC 360 ms
66,960 KB
testcase_22 AC 375 ms
67,176 KB
testcase_23 AC 317 ms
51,636 KB
testcase_24 AC 348 ms
67,080 KB
testcase_25 AC 318 ms
51,768 KB
testcase_26 WA -
testcase_27 AC 354 ms
67,456 KB
testcase_28 WA -
testcase_29 AC 359 ms
67,280 KB
testcase_30 WA -
testcase_31 AC 357 ms
67,164 KB
testcase_32 AC 327 ms
55,564 KB
testcase_33 AC 353 ms
67,112 KB
testcase_34 WA -
testcase_35 AC 359 ms
66,916 KB
testcase_36 AC 313 ms
51,692 KB
testcase_37 AC 312 ms
51,548 KB
testcase_38 AC 313 ms
51,432 KB
testcase_39 AC 315 ms
51,432 KB
testcase_40 AC 312 ms
51,404 KB
testcase_41 AC 311 ms
51,540 KB
testcase_42 AC 309 ms
51,660 KB
testcase_43 AC 322 ms
52,260 KB
testcase_44 AC 318 ms
53,472 KB
testcase_45 AC 318 ms
51,472 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:43:13: warning: 'appendln(String?): kotlin.text.StringBuilder /* = java.lang.StringBuilder */' is deprecated. Use appendLine instead. Note that the new method always appends the line feed character '\n' regardless of the system line separator.
    builder.appendln(if (ok) "YES" else "NO")
            ^

ソースコード

diff #

import kotlin.math.max

fun main() {
    val builder = StringBuilder()

    val (h, w) = readInputLine().split(" ").map { it.toInt() }

    val map = Array(h) { readInputLine().toCharArray() }

    var ok = false

    for (i in 0 until h) {
        if (ok) {
            break
        }
        for (j in 0 until w) {
            val tmp = Array(h) { map[it].copyOf() }
            var ng = false

            for (k in 0 until h) {
                if (ng) {
                    break
                }
                for (l in 0 until w) {
                    if (tmp[k][l] == '#') {
                        tmp[k][l] = 'r'
                        if (k + i >= h || l + j >= w || tmp[k + i][l + j] != '#') {
                            ng = true
                            break
                        }
                        tmp[k + i][l + j] = 'b'
                    }
                }
            }

            if (!ng) {
                ok = true
                break
            }
        }
    }

    builder.appendln(if (ok) "YES" else "NO")

    print(builder.toString())
}

fun readInputLine(): String {
    return readLine()!!
}
0