結果

問題 No.307 最近色塗る問題多くない?
ユーザー javyjavy
提出日時 2015-11-27 23:35:51
言語 Kotlin
(1.9.23)
結果
RE  
実行時間 -
コード長 2,256 bytes
コンパイル時間 13,118 ms
コンパイル使用メモリ 434,688 KB
実行使用メモリ 91,120 KB
最終ジャッジ日時 2024-04-30 09:18:13
合計ジャッジ時間 35,017 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 314 ms
56,984 KB
testcase_01 AC 315 ms
56,944 KB
testcase_02 AC 313 ms
56,964 KB
testcase_03 AC 314 ms
57,056 KB
testcase_04 AC 362 ms
57,300 KB
testcase_05 AC 333 ms
56,912 KB
testcase_06 AC 344 ms
57,228 KB
testcase_07 AC 900 ms
63,148 KB
testcase_08 RE -
testcase_09 RE -
testcase_10 AC 565 ms
61,948 KB
testcase_11 AC 673 ms
66,676 KB
testcase_12 AC 321 ms
56,992 KB
testcase_13 AC 592 ms
76,512 KB
testcase_14 AC 498 ms
57,992 KB
testcase_15 AC 512 ms
58,384 KB
testcase_16 AC 486 ms
58,240 KB
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 AC 399 ms
57,448 KB
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 AC 1,001 ms
78,640 KB
testcase_28 RE -
testcase_29 AC 542 ms
72,352 KB
testcase_30 RE -
testcase_31 AC 1,065 ms
90,852 KB
testcase_32 AC 1,063 ms
91,120 KB
testcase_33 RE -
testcase_34 AC 1,083 ms
91,108 KB
testcase_35 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:6:10: warning: parameter 'args' is never used
fun main(args: Array<String>) {
         ^

ソースコード

diff #

package Yukicoder

/**
 * Created by hichikawa on 2015/11/12.
 */
fun main(args: Array<String>) {
    fun readLineLongArray(): List<Long> {
        val str = readLine() as String
        val arrStr = str.split(" ")
        val ret = arrStr.map { it.toLong() }
        return ret
    }

    fun readLineLong(): Long {
        val str = readLine() as String
        return str.toLong()
    }

    fun readLineInt(): Int {
        val str = readLine() as String
        return str.toInt()
    }

    fun readLineIntArray() : List<Int> {
        val str = readLine() as String
        val arrStr = str.split(" ")
        val ret = arrStr.map { it.toInt() }
        return ret
    }

    fun readLineDoubleArray(): List<Double> {
        val str = readLine() as String
        val arrStr = str.split(" ")
        val ret = arrStr.map { it.toDouble() }
        return ret
    }

    fun readLineStringArray(): List<String> {
        val str = readLine() as String
        val arrStr = str.split(" ")
        return arrStr
    }

    fun repaintArray(arrArea : Array<Array<Int>>, x : Int, y : Int, color : Int, H : Int, W : Int) : Array<Array<Int>>{
        if (arrArea[x][y] == color) {
            return arrArea
        }
        arrArea[x][y] = color
        if (x > 0 && arrArea[x-1][y] != color) {
            repaintArray(arrArea, x-1, y, color, H, W)
        }
        if (y > 0 && arrArea[x][y-1] != color) {
            repaintArray(arrArea, x, y-1, color, H, W)
        }
        if (x < H-1 && arrArea[x+1][y] != color) {
            repaintArray(arrArea, x+1, y, color, H, W)
        }
        if (y < W-1 && arrArea[x][y+1] != color) {
            repaintArray(arrArea, x, y+1, color, H, W)
        }
        return arrArea
    }

    val input1 = readLineIntArray()
    val H = input1[0]
    val W = input1[1]
    var arrArea = Array(H , {readLineIntArray().toTypedArray()})
    val repaintNum = readLineInt()
    for (i in 1..repaintNum) {
        val input = readLineIntArray()
        repaintArray(arrArea, input[0]-1, input[1]-1, input[2], H, W)
    }
    for (line in arrArea) {
        for ((i, c) in line.withIndex()) {
            if (i!=0) {
                print(" ")
            }
            print(c)
        }
        println()
    }
}
0