結果

問題 No.359 門松行列
ユーザー syarosyaro
提出日時 2017-12-01 20:39:52
言語 Ruby
(3.3.0)
結果
AC  
実行時間 129 ms / 2,000 ms
コード長 318 bytes
コンパイル時間 56 ms
コンパイル使用メモリ 11,380 KB
実行使用メモリ 15,412 KB
最終ジャッジ日時 2023-08-18 16:15:58
合計ジャッジ時間 2,731 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
15,112 KB
testcase_01 AC 78 ms
15,172 KB
testcase_02 AC 79 ms
15,280 KB
testcase_03 AC 108 ms
15,272 KB
testcase_04 AC 89 ms
15,212 KB
testcase_05 AC 113 ms
15,276 KB
testcase_06 AC 84 ms
15,396 KB
testcase_07 AC 106 ms
15,412 KB
testcase_08 AC 129 ms
15,360 KB
testcase_09 AC 122 ms
15,252 KB
testcase_10 AC 127 ms
15,180 KB
testcase_11 AC 116 ms
15,164 KB
testcase_12 AC 114 ms
15,208 KB
testcase_13 AC 127 ms
15,356 KB
testcase_14 AC 126 ms
15,308 KB
testcase_15 AC 94 ms
15,392 KB
testcase_16 AC 125 ms
15,404 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

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