結果

問題 No.455 冬の大三角
ユーザー 💕💖💞💕💖💞
提出日時 2018-06-28 16:22:09
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 379 ms / 2,000 ms
コード長 1,342 bytes
コンパイル時間 14,277 ms
コンパイル使用メモリ 441,728 KB
実行使用メモリ 57,420 KB
最終ジャッジ日時 2024-04-30 19:01:13
合計ジャッジ時間 31,168 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 278 ms
57,044 KB
testcase_01 AC 276 ms
57,012 KB
testcase_02 AC 288 ms
57,116 KB
testcase_03 AC 274 ms
57,076 KB
testcase_04 AC 275 ms
57,008 KB
testcase_05 AC 284 ms
57,156 KB
testcase_06 AC 273 ms
57,040 KB
testcase_07 AC 270 ms
56,920 KB
testcase_08 AC 345 ms
57,420 KB
testcase_09 AC 273 ms
56,996 KB
testcase_10 AC 272 ms
56,896 KB
testcase_11 AC 279 ms
57,076 KB
testcase_12 AC 275 ms
56,912 KB
testcase_13 AC 272 ms
56,908 KB
testcase_14 AC 276 ms
56,928 KB
testcase_15 AC 285 ms
56,916 KB
testcase_16 AC 282 ms
56,928 KB
testcase_17 AC 274 ms
56,912 KB
testcase_18 AC 283 ms
56,924 KB
testcase_19 AC 277 ms
57,008 KB
testcase_20 AC 274 ms
56,924 KB
testcase_21 AC 282 ms
56,976 KB
testcase_22 AC 279 ms
57,088 KB
testcase_23 AC 276 ms
57,048 KB
testcase_24 AC 281 ms
57,020 KB
testcase_25 AC 283 ms
56,872 KB
testcase_26 AC 279 ms
56,896 KB
testcase_27 AC 282 ms
57,012 KB
testcase_28 AC 284 ms
57,032 KB
testcase_29 AC 342 ms
57,304 KB
testcase_30 AC 309 ms
57,064 KB
testcase_31 AC 301 ms
57,156 KB
testcase_32 AC 295 ms
57,024 KB
testcase_33 AC 343 ms
57,268 KB
testcase_34 AC 285 ms
57,096 KB
testcase_35 AC 331 ms
57,200 KB
testcase_36 AC 309 ms
57,196 KB
testcase_37 AC 308 ms
57,032 KB
testcase_38 AC 298 ms
57,300 KB
testcase_39 AC 379 ms
57,264 KB
testcase_40 AC 348 ms
57,288 KB
testcase_41 AC 338 ms
57,224 KB
testcase_42 AC 306 ms
57,092 KB
testcase_43 AC 305 ms
57,028 KB
testcase_44 AC 291 ms
57,116 KB
testcase_45 AC 348 ms
57,276 KB
testcase_46 AC 346 ms
57,136 KB
testcase_47 AC 317 ms
57,172 KB
testcase_48 AC 300 ms
57,144 KB
testcase_49 AC 296 ms
56,964 KB
testcase_50 AC 286 ms
56,996 KB
testcase_51 AC 282 ms
57,208 KB
testcase_52 AC 295 ms
57,188 KB
testcase_53 AC 294 ms
57,080 KB
testcase_54 AC 283 ms
57,120 KB
testcase_55 AC 293 ms
57,104 KB
testcase_56 AC 288 ms
57,176 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:1:10: warning: parameter 'args' is never used
fun main(args:Array<String>) {
         ^

ソースコード

diff #

fun main(args:Array<String>) {
  val (h, w) = readLine()!!.split(" ").map(String::toInt)
  val xs = (1..h).map {
    readLine()!!.toList().toMutableList()
  }
  outer@for( hstart in (0..h-1) ) {
    for( wstart in (0..w-1) ) {
      if( hstart == 0 && wstart == 0 ) continue
      val copy = xs.map { it.toMutableList() }

      copy[hstart][wstart] = '*'
      if( copy.flatten().filter { it == '*' }.size != 3 ) continue

      val triples = mutableListOf<Pair<Int,Int>>()
      copy.mapIndexed { height, copy_line ->
        copy_line.mapIndexed { width, char ->
          if( char == '*' ) triples.add( Pair(height+1, width+1) )
        }
      }
      if( ( triples[0].first == triples[1].first && triples[1].first == triples[2].first ) ||
          ( triples[0].second == triples[1].second && triples[1].second == triples[2].second ) ) continue

      // ベクトルを作成
      val (x, y) = Pair( triples[1].first.toDouble() - triples[0].first, (triples[1].second.toDouble() - triples[0].second) )
      //println("$x $y ${(triples[2].first.toDouble()+1.0)/x} ${(triples[2].second.toDouble()+1.0)/y}")
      if( (triples[2].first.toDouble()-triples[1].first.toDouble())/x == (triples[2].second.toDouble()-triples[1].second.toDouble())/y) continue

      copy.map { it.joinToString("").run(::println) }
      break@outer
    }
  }
}
0