結果

問題 No.565 回転拡大
ユーザー 💕💖💞💕💖💞
提出日時 2018-06-28 12:59:58
言語 Kotlin
(1.9.23)
結果
RE  
実行時間 -
コード長 1,139 bytes
コンパイル時間 16,558 ms
コンパイル使用メモリ 458,640 KB
実行使用メモリ 59,412 KB
最終ジャッジ日時 2024-04-30 18:58:00
合計ジャッジ時間 30,048 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 516 ms
59,412 KB
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 AC 384 ms
57,460 KB
testcase_05 AC 347 ms
57,076 KB
testcase_06 AC 388 ms
57,344 KB
testcase_07 AC 385 ms
57,416 KB
testcase_08 WA -
testcase_09 AC 349 ms
57,152 KB
testcase_10 AC 349 ms
57,124 KB
testcase_11 AC 379 ms
57,348 KB
testcase_12 WA -
testcase_13 AC 358 ms
57,296 KB
testcase_14 AC 350 ms
57,356 KB
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 AC 380 ms
57,436 KB
testcase_19 AC 392 ms
57,420 KB
testcase_20 AC 348 ms
57,208 KB
testcase_21 AC 362 ms
57,220 KB
testcase_22 AC 380 ms
57,324 KB
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 AC 384 ms
57,440 KB
testcase_28 AC 388 ms
57,416 KB
testcase_29 RE -
testcase_30 AC 347 ms
57,072 KB
testcase_31 AC 365 ms
57,200 KB
testcase_32 AC 347 ms
57,192 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:1:10: warning: parameter 'args' is never used
fun main(args:Array<String>) {
         ^

ソースコード

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 ->
    // 90

    val lambdasy = mapOf<Int, (Int)->Int>( 0 to { y -> y }, 90 to { y -> y }, 180 to { y -> w - 1 - y}, 270 to { y -> w - 1 - y } )
    val lambdasx = mapOf<Int, (Int)->Int>( 0 to { x -> x }, 90 to { x -> h - 1 - x }, 180 to { x -> h - 1 - x}, 270 to { x -> x } )
    (0..w-1).map { y ->
    (0..h-1).map { x ->
      val transy = lambdasy[r]!!(y)
      val transx = lambdasx[r]!!(x) //h -1 - x
      base[transy][transx] = orig[x][y]
    }
    }

    base.map { xs ->
      (1..k).map {
        xs.map { x ->
          (1..k).map { print(x.toString()) }
        }
        println("")
      }
    }
  }
}
0