結果

問題 No.359 門松行列
ユーザー syarosyaro
提出日時 2017-12-01 20:44:44
言語 Ruby
(3.2.2)
結果
AC  
実行時間 135 ms / 2,000 ms
コード長 317 bytes
コンパイル時間 60 ms
コンパイル使用メモリ 11,524 KB
実行使用メモリ 15,464 KB
最終ジャッジ日時 2023-08-18 16:16:04
合計ジャッジ時間 2,797 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 85 ms
15,084 KB
testcase_01 AC 76 ms
15,112 KB
testcase_02 AC 79 ms
15,036 KB
testcase_03 AC 116 ms
15,240 KB
testcase_04 AC 97 ms
15,464 KB
testcase_05 AC 118 ms
15,256 KB
testcase_06 AC 85 ms
15,340 KB
testcase_07 AC 105 ms
15,436 KB
testcase_08 AC 132 ms
15,444 KB
testcase_09 AC 126 ms
15,212 KB
testcase_10 AC 135 ms
15,348 KB
testcase_11 AC 124 ms
15,288 KB
testcase_12 AC 117 ms
15,428 KB
testcase_13 AC 132 ms
15,312 KB
testcase_14 AC 126 ms
15,300 KB
testcase_15 AC 98 ms
15,288 KB
testcase_16 AC 125 ms
15,248 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;0<a&&a<L&&[[i=0,3,6],[2],0..2,[0]].all?{|k|i+=1;k.all?{|k|k=A.values_at k,k+=i,k+i;k.sort[1]!=k[1]&&k|[]==k}}};A<<L/2;A.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