結果

問題 No.359 門松行列
ユーザー syarosyaro
提出日時 2017-12-01 20:25:12
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 323 bytes
コンパイル時間 120 ms
コンパイル使用メモリ 11,392 KB
実行使用メモリ 15,552 KB
最終ジャッジ日時 2023-08-18 16:15:51
合計ジャッジ時間 2,616 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
15,236 KB
testcase_01 AC 83 ms
15,276 KB
testcase_02 AC 76 ms
15,096 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 93 ms
15,424 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

gets.to_i.times{eval"L,*A="+$<.take(4).join.split*?,
x,y=(0..8).select{|i|A[i]<1}
q=->a{A[x]=a
A[y]=L-a
i=0
0<a&&a<L&&[[1,4,7],[4],3..5,[4]].all?{|k|i+=1
k.all?{|k|k=A.values_at k-i,k,k+i
k.sort[1]!=k[1]&&k|[]==k}}}
*g=L/2
A.map{|a|-1.upto(1){|i|g<<a+i<<L-a+i}}
v=a=0
g.sort.uniq.map{|b|v+=q[a]&&q[b]?b-a:q[b]?1:0
a=b}
p v}
0