結果
問題 | No.455 冬の大三角 |
ユーザー |
![]() |
提出日時 | 2018-06-28 16:22:09 |
言語 | Kotlin (2.1.0) |
結果 |
AC
|
実行時間 | 360 ms / 2,000 ms |
コード長 | 1,342 bytes |
コンパイル時間 | 14,434 ms |
コンパイル使用メモリ | 450,064 KB |
実行使用メモリ | 52,796 KB |
最終ジャッジ日時 | 2024-11-20 16:32:11 |
合計ジャッジ時間 | 32,436 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 54 |
コンパイルメッセージ
Main.kt:1:10: warning: parameter 'args' is never used fun main(args:Array<String>) { ^
ソースコード
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 ) continueval copy = xs.map { it.toMutableList() }copy[hstart][wstart] = '*'if( copy.flatten().filter { it == '*' }.size != 3 ) continueval 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) continuecopy.map { it.joinToString("").run(::println) }break@outer}}}