結果

問題 No.3 ビットすごろく
ユーザー mmmpppmmmppp
提出日時 2017-02-27 22:08:56
言語 Ruby
(3.3.0)
結果
AC  
実行時間 1,778 ms / 5,000 ms
コード長 189 bytes
コンパイル時間 92 ms
コンパイル使用メモリ 11,444 KB
実行使用メモリ 15,728 KB
最終ジャッジ日時 2023-09-14 00:25:08
合計ジャッジ時間 24,767 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
15,016 KB
testcase_01 AC 82 ms
15,224 KB
testcase_02 AC 80 ms
15,152 KB
testcase_03 AC 187 ms
15,348 KB
testcase_04 AC 97 ms
15,124 KB
testcase_05 AC 585 ms
15,632 KB
testcase_06 AC 213 ms
15,564 KB
testcase_07 AC 127 ms
15,272 KB
testcase_08 AC 390 ms
15,528 KB
testcase_09 AC 902 ms
15,516 KB
testcase_10 AC 1,215 ms
15,412 KB
testcase_11 AC 770 ms
15,668 KB
testcase_12 AC 559 ms
15,560 KB
testcase_13 AC 155 ms
15,296 KB
testcase_14 AC 1,143 ms
15,556 KB
testcase_15 AC 1,694 ms
15,468 KB
testcase_16 AC 1,547 ms
15,644 KB
testcase_17 AC 1,642 ms
15,460 KB
testcase_18 AC 139 ms
15,288 KB
testcase_19 AC 1,713 ms
15,720 KB
testcase_20 AC 85 ms
15,096 KB
testcase_21 AC 80 ms
15,284 KB
testcase_22 AC 1,166 ms
15,680 KB
testcase_23 AC 1,738 ms
15,728 KB
testcase_24 AC 1,778 ms
15,640 KB
testcase_25 AC 1,723 ms
15,416 KB
testcase_26 AC 79 ms
15,344 KB
testcase_27 AC 167 ms
15,388 KB
testcase_28 AC 1,432 ms
15,676 KB
testcase_29 AC 812 ms
15,684 KB
testcase_30 AC 80 ms
15,240 KB
testcase_31 AC 81 ms
15,156 KB
testcase_32 AC 697 ms
15,564 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n=gets.to_i+1
a=(0..n).map{|i|('%b'%i).count ?1};a[0]=1
r=[-1]*n;r[0]=0
n.times{|i|r.include?(i)&&n.times{|j|
r[j]==i&&(x=j-a[j];y=j+j-x
x*r[x]<0&&r[x]=i+1
y<n&&r[y]<0&&r[y]=i+1)}}
p r[n-1]
0