結果

問題 No.565 回転拡大
ユーザー 💕💖💞💕💖💞
提出日時 2018-06-28 13:24:29
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 449 ms / 2,000 ms
コード長 1,267 bytes
コンパイル時間 16,224 ms
コンパイル使用メモリ 450,796 KB
実行使用メモリ 59,380 KB
最終ジャッジ日時 2024-04-30 18:58:36
合計ジャッジ時間 25,090 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 449 ms
59,380 KB
testcase_01 AC 331 ms
57,356 KB
testcase_02 AC 326 ms
57,424 KB
testcase_03 AC 288 ms
57,200 KB
testcase_04 AC 330 ms
57,320 KB
testcase_05 AC 295 ms
57,184 KB
testcase_06 AC 325 ms
57,428 KB
testcase_07 AC 327 ms
57,364 KB
testcase_08 AC 341 ms
57,372 KB
testcase_09 AC 292 ms
57,244 KB
testcase_10 AC 293 ms
57,232 KB
testcase_11 AC 318 ms
57,308 KB
testcase_12 AC 332 ms
57,460 KB
testcase_13 AC 298 ms
57,348 KB
testcase_14 AC 299 ms
57,164 KB
testcase_15 AC 329 ms
57,360 KB
testcase_16 AC 322 ms
57,496 KB
testcase_17 AC 301 ms
57,136 KB
testcase_18 AC 324 ms
57,328 KB
testcase_19 AC 345 ms
57,336 KB
testcase_20 AC 302 ms
57,392 KB
testcase_21 AC 301 ms
57,336 KB
testcase_22 AC 337 ms
57,400 KB
testcase_23 AC 302 ms
57,312 KB
testcase_24 AC 351 ms
57,444 KB
testcase_25 AC 343 ms
57,340 KB
testcase_26 AC 321 ms
57,472 KB
testcase_27 AC 320 ms
57,340 KB
testcase_28 AC 327 ms
57,484 KB
testcase_29 AC 331 ms
57,372 KB
testcase_30 AC 288 ms
57,036 KB
testcase_31 AC 294 ms
57,096 KB
testcase_32 AC 299 ms
57,096 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:1:10: warning: parameter 'args' is never used
fun main(args:Array<String>) {
         ^
Main.kt:14:59: warning: parameter 'x' is never used, could be renamed to _
    val lambdasy = mapOf<Int, (Int, Int)->Int>( 0 to { y, x -> y }, 90 to { y, x -> x }, 180 to { y,x -> h - 1 - y }, 270 to { y,x -> w - 1 - x } )
                                                          ^
Main.kt:14:77: warning: parameter 'y' is never used, could be renamed to _
    val lambdasy = mapOf<Int, (Int, Int)->Int>( 0 to { y, x -> y }, 90 to { y, x -> x }, 180 to { y,x -> h - 1 - y }, 270 to { y,x -> w - 1 - x } )
                                                                            ^
Main.kt:14:101: warning: parameter 'x' is never used, could be renamed to _
    val lambdasy = mapOf<Int, (Int, Int)->Int>( 0 to { y, x -> y }, 90 to { y, x -> x }, 180 to { y,x -> h - 1 - y }, 270 to { y,x -> w - 1 - x } )
                                                                                                    ^
Main.kt:14:128: warning: parameter 'y' is never used, could be renamed to _
    val lambdasy = mapOf<Int, (Int, Int)->Int>( 0 to { y, x -> y }, 90 to { y, x -> x }, 180 to { y,x -> h - 1 - y }, 270 to { y,x -> w - 1 - x } )
                                                                                                                               ^
Main.kt:15:56: warning: parameter 'y' is never used, could be renamed to _
    val lambdasx = mapOf<Int, (Int, Int)->Int>( 0 to { y, x -> x }, 90 to { y, x -> h - 1 - y }, 180 to { y, x -> w - 1 - x }, 270 to { y,x -> y } )
                                                       ^
Main.kt:15:80: warning: parameter 'x' is never used, could be renamed to _
    val lambdasx = mapOf<Int, (Int, Int)->Int>( 0 to { y, x -> x }, 90 to { y, x -> h - 1 - y }, 180 to { y, x -> w - 1 - x }, 270 to { y,x -> y } )
                                                                               ^
Main.kt:15:107: warning: parameter 'y' is never used, c

ソースコード

diff #

fun main(args:Array<String>) {
  val (r, k) = readLine()!!.split(" ").map(String::toInt)
  val (h, w) = readLine()!!.split(" ").map(String::toInt)

  val orig = (1..h).map { readLine()!!.toList() }

  // make base
  when(r) {
    0    -> (1..h).map { (1..w).map { null }.toMutableList<Char?>() }
    90   -> (1..w).map { (1..h).map { null }.toMutableList<Char?>() }
    180  -> (1..h).map { (1..w).map { null }.toMutableList<Char?>() }
    else -> (1..w).map { (1..h).map { null }.toMutableList<Char?>() }
  }.let { base ->
    val lambdasy = mapOf<Int, (Int, Int)->Int>( 0 to { y, x -> y }, 90 to { y, x -> x }, 180 to { y,x -> h - 1 - y }, 270 to { y,x -> w - 1 - x } )
    val lambdasx = mapOf<Int, (Int, Int)->Int>( 0 to { y, x -> x }, 90 to { y, x -> h - 1 - y }, 180 to { y, x -> w - 1 - x }, 270 to { y,x -> y } )
    (0..h-1).map { y ->
    (0..w-1).map { x ->
      val transy = lambdasy[r]!!(y, x)
      val transx = lambdasx[r]!!(y, x) //h -1 - x
      orig[y][x]
      base[transy][transx] = orig[y][x]
      //println("$transy $transx $x $y ${base.size} ${base[0].size} ${orig[y][x]}")
    }
    }
    base.map { xs ->
      (1..k).map {
        xs.map { x ->
          (1..k).map { print(x.toString()) }
        }
        println("")
      }
    }
  }
}
0