結果

問題 No.455 冬の大三角
コンテスト
ユーザー 💕💖💞
提出日時 2018-06-28 16:01:44
言語 Kotlin
(2.3.20)
コンパイル:
kotlinc _filename_ -include-runtime -d main.jar
実行:
kotlin main.jar
結果
WA  
実行時間 -
コード長 1,187 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 9,138 ms
コンパイル使用メモリ 471,336 KB
実行使用メモリ 54,072 KB
最終ジャッジ日時 2026-05-14 19:30:02
合計ジャッジ時間 22,984 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 53 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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) ) {
      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, width) )
        }
      }
      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() + 1.0) / (triples[0].first+1.0), (triples[1].second.toDouble()+1.0)/(triples[0].second+1.0) )
     //println("$x $y")
     if( (triples[2].first.toDouble()+1.0)/x == (triples[2].second.toDouble()+1.0)/y) continue

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