結果

問題 No.455 冬の大三角
ユーザー 💕💖💞💕💖💞
提出日時 2018-06-28 16:01:44
言語 Kotlin
(1.9.23)
結果
WA  
実行時間 -
コード長 1,187 bytes
コンパイル時間 14,223 ms
コンパイル使用メモリ 447,700 KB
実行使用メモリ 57,280 KB
最終ジャッジ日時 2024-04-30 18:59:59
合計ジャッジ時間 36,000 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 323 ms
56,900 KB
testcase_01 AC 320 ms
56,888 KB
testcase_02 AC 325 ms
57,212 KB
testcase_03 AC 318 ms
57,036 KB
testcase_04 AC 317 ms
57,016 KB
testcase_05 AC 317 ms
56,992 KB
testcase_06 AC 324 ms
56,876 KB
testcase_07 AC 317 ms
56,884 KB
testcase_08 AC 399 ms
57,276 KB
testcase_09 AC 322 ms
56,892 KB
testcase_10 AC 317 ms
56,928 KB
testcase_11 AC 316 ms
56,896 KB
testcase_12 AC 332 ms
57,000 KB
testcase_13 AC 317 ms
56,896 KB
testcase_14 AC 325 ms
56,876 KB
testcase_15 AC 320 ms
56,888 KB
testcase_16 AC 321 ms
56,940 KB
testcase_17 AC 318 ms
56,892 KB
testcase_18 AC 316 ms
56,900 KB
testcase_19 AC 317 ms
57,016 KB
testcase_20 AC 317 ms
56,944 KB
testcase_21 AC 315 ms
56,724 KB
testcase_22 AC 320 ms
57,048 KB
testcase_23 AC 320 ms
57,012 KB
testcase_24 AC 318 ms
56,988 KB
testcase_25 AC 321 ms
56,928 KB
testcase_26 AC 320 ms
56,904 KB
testcase_27 AC 323 ms
57,004 KB
testcase_28 AC 318 ms
56,996 KB
testcase_29 AC 397 ms
57,136 KB
testcase_30 AC 361 ms
57,076 KB
testcase_31 AC 348 ms
57,004 KB
testcase_32 AC 343 ms
57,008 KB
testcase_33 AC 396 ms
57,256 KB
testcase_34 AC 330 ms
57,168 KB
testcase_35 AC 382 ms
57,280 KB
testcase_36 AC 357 ms
57,028 KB
testcase_37 AC 341 ms
57,100 KB
testcase_38 AC 337 ms
57,020 KB
testcase_39 AC 396 ms
57,184 KB
testcase_40 AC 360 ms
57,140 KB
testcase_41 AC 357 ms
57,060 KB
testcase_42 AC 342 ms
57,016 KB
testcase_43 AC 334 ms
56,996 KB
testcase_44 AC 335 ms
57,092 KB
testcase_45 AC 387 ms
57,224 KB
testcase_46 AC 351 ms
57,060 KB
testcase_47 AC 349 ms
57,060 KB
testcase_48 AC 342 ms
56,980 KB
testcase_49 AC 318 ms
56,900 KB
testcase_50 AC 320 ms
56,944 KB
testcase_51 AC 330 ms
57,200 KB
testcase_52 WA -
testcase_53 AC 330 ms
57,104 KB
testcase_54 AC 336 ms
57,196 KB
testcase_55 AC 335 ms
57,172 KB
testcase_56 AC 332 ms
57,128 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) ) {
      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