結果

問題 No.640 76本のトロンボーン
ユーザー 👑 hos.lyrichos.lyric
提出日時 2019-01-29 11:25:59
言語 Ruby
(3.3.0)
結果
AC  
実行時間 135 ms / 2,000 ms
コード長 420 bytes
コンパイル時間 373 ms
コンパイル使用メモリ 11,256 KB
実行使用メモリ 15,572 KB
最終ジャッジ日時 2023-09-27 23:01:33
合計ジャッジ時間 3,282 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
15,240 KB
testcase_01 AC 83 ms
15,136 KB
testcase_02 AC 82 ms
15,084 KB
testcase_03 AC 83 ms
15,304 KB
testcase_04 AC 85 ms
15,304 KB
testcase_05 AC 84 ms
15,144 KB
testcase_06 AC 133 ms
15,540 KB
testcase_07 AC 132 ms
15,404 KB
testcase_08 AC 135 ms
15,520 KB
testcase_09 AC 135 ms
15,572 KB
testcase_10 AC 134 ms
15,512 KB
testcase_11 AC 134 ms
15,288 KB
testcase_12 AC 135 ms
15,548 KB
testcase_13 AC 82 ms
15,164 KB
testcase_14 AC 129 ms
15,492 KB
testcase_15 AC 82 ms
15,128 KB
testcase_16 AC 84 ms
15,244 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

k=0...n=gets.to_i
i=0..n-2
j=1...n
a=k.map{gets}
z=0
2.times{|r|3.times{|s|3.times{|t|
  d=k.map{|x|k.map{|y|(r<1?a[x][y]:a[y][x])>'$'}}
  w=0
  e=d[0]
  s<1&&e[i].all?&&i.map{|y|e[y]=nil}&&w=1
  s>1&&e[j].all?&&j.map{|y|e[y]=nil}&&w=1
  e=d[-1]
  t<1&&e[i].all?&&i.map{|y|e[y]=nil}&&w+=1
  t>1&&e[j].all?&&j.map{|y|e[y]=nil}&&w+=1
  k.map{|y|
    f=d.map{|e|e[y]}
    (f[i].all?||f[j].all?)&&w+=1
  }
  z<w&&z=w
}}}
p z
0