結果

問題 No.455 冬の大三角
ユーザー 💕💖💞💕💖💞
提出日時 2018-06-28 16:17:14
言語 Kotlin
(1.9.23)
結果
WA  
実行時間 -
コード長 1,318 bytes
コンパイル時間 13,210 ms
コンパイル使用メモリ 448,952 KB
実行使用メモリ 57,332 KB
最終ジャッジ日時 2024-04-30 19:00:37
合計ジャッジ時間 34,395 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 306 ms
57,068 KB
testcase_01 AC 303 ms
57,004 KB
testcase_02 AC 309 ms
57,168 KB
testcase_03 AC 300 ms
57,148 KB
testcase_04 AC 305 ms
56,892 KB
testcase_05 AC 304 ms
56,864 KB
testcase_06 AC 312 ms
57,004 KB
testcase_07 AC 307 ms
56,972 KB
testcase_08 AC 386 ms
57,272 KB
testcase_09 AC 303 ms
56,992 KB
testcase_10 AC 305 ms
56,968 KB
testcase_11 AC 313 ms
56,848 KB
testcase_12 AC 308 ms
56,936 KB
testcase_13 AC 308 ms
56,992 KB
testcase_14 AC 304 ms
57,144 KB
testcase_15 AC 311 ms
56,928 KB
testcase_16 AC 311 ms
57,056 KB
testcase_17 AC 311 ms
56,988 KB
testcase_18 AC 309 ms
56,824 KB
testcase_19 AC 308 ms
56,940 KB
testcase_20 AC 312 ms
57,016 KB
testcase_21 AC 305 ms
56,888 KB
testcase_22 AC 312 ms
57,080 KB
testcase_23 AC 305 ms
56,992 KB
testcase_24 AC 305 ms
56,920 KB
testcase_25 AC 312 ms
56,864 KB
testcase_26 AC 308 ms
57,084 KB
testcase_27 AC 305 ms
56,876 KB
testcase_28 AC 312 ms
57,004 KB
testcase_29 AC 397 ms
57,220 KB
testcase_30 AC 349 ms
57,008 KB
testcase_31 AC 335 ms
57,020 KB
testcase_32 AC 331 ms
57,132 KB
testcase_33 AC 379 ms
57,112 KB
testcase_34 AC 320 ms
57,240 KB
testcase_35 AC 367 ms
57,160 KB
testcase_36 AC 337 ms
57,148 KB
testcase_37 AC 326 ms
56,984 KB
testcase_38 AC 321 ms
57,036 KB
testcase_39 AC 375 ms
57,332 KB
testcase_40 AC 348 ms
57,168 KB
testcase_41 AC 342 ms
57,136 KB
testcase_42 AC 326 ms
57,052 KB
testcase_43 AC 318 ms
56,996 KB
testcase_44 AC 319 ms
57,176 KB
testcase_45 AC 380 ms
57,256 KB
testcase_46 AC 342 ms
57,156 KB
testcase_47 AC 329 ms
57,172 KB
testcase_48 AC 328 ms
56,980 KB
testcase_49 WA -
testcase_50 AC 313 ms
56,888 KB
testcase_51 AC 314 ms
57,036 KB
testcase_52 AC 323 ms
57,120 KB
testcase_53 AC 319 ms
57,088 KB
testcase_54 AC 317 ms
56,964 KB
testcase_55 WA -
testcase_56 AC 324 ms
57,052 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, 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 ${(triples[2].first.toDouble()+1.0)/x} ${(triples[2].second.toDouble()+1.0)/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