結果
問題 | No.3 ビットすごろく |
ユーザー | yoza |
提出日時 | 2016-12-12 22:25:42 |
言語 | Vim script (v9.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 990 bytes |
コンパイル時間 | 208 ms |
コンパイル使用メモリ | 5,380 KB |
実行使用メモリ | 6,104 KB |
最終ジャッジ日時 | 2023-08-19 21:47:07 |
合計ジャッジ時間 | 5,964 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 4 ms
5,632 KB |
testcase_01 | AC | 3 ms
5,684 KB |
testcase_02 | AC | 3 ms
5,716 KB |
testcase_03 | AC | 69 ms
5,744 KB |
testcase_04 | AC | 23 ms
5,744 KB |
testcase_05 | AC | 145 ms
5,868 KB |
testcase_06 | AC | 75 ms
5,816 KB |
testcase_07 | AC | 45 ms
5,796 KB |
testcase_08 | AC | 117 ms
5,824 KB |
testcase_09 | AC | 189 ms
5,920 KB |
testcase_10 | AC | 226 ms
6,040 KB |
testcase_11 | AC | 172 ms
5,852 KB |
testcase_12 | AC | 142 ms
5,816 KB |
testcase_13 | AC | 58 ms
5,900 KB |
testcase_14 | AC | 218 ms
6,104 KB |
testcase_15 | AC | 271 ms
6,020 KB |
testcase_16 | AC | 249 ms
5,972 KB |
testcase_17 | AC | 264 ms
6,016 KB |
testcase_18 | AC | 50 ms
5,804 KB |
testcase_19 | AC | 273 ms
6,040 KB |
testcase_20 | AC | 18 ms
5,648 KB |
testcase_21 | AC | 4 ms
5,628 KB |
testcase_22 | AC | 221 ms
5,960 KB |
testcase_23 | AC | 271 ms
6,044 KB |
testcase_24 | AC | 273 ms
5,972 KB |
testcase_25 | AC | 274 ms
5,972 KB |
testcase_26 | WA | - |
testcase_27 | AC | 64 ms
5,824 KB |
testcase_28 | AC | 247 ms
5,964 KB |
testcase_29 | AC | 174 ms
5,776 KB |
testcase_30 | AC | 6 ms
5,800 KB |
testcase_31 | AC | 8 ms
5,688 KB |
testcase_32 | AC | 162 ms
5,824 KB |
ソースコード
function! s:output() let this = {'lines': []} function! this.append(line) abort call add(self.lines, a:line) endfunction function! this.build() abort return join(self.lines, "\n") endfunction return this endfunction function! s:main(input) abort let o = s:output() let n = str2nr(a:input[0]) let next = 1 let cells = {'1': 1} let q = [1] let r = -1 while len(q) > 0 let c = remove(q, 0) let b = printf('%b', c) let move = len(b) - len(substitute(b, '1', '', 'g')) let left = c - move let right = c + move if left > 0 && !has_key(cells, left) let cells[left] = cells[c] + 1 call add(q, left) endif if right < n && !has_key(cells, right) let cells[right] = cells[c] + 1 call add(q, right) endif if right == n let r = cells[c] + 1 break endif endwhile call o.append(r) return o.build() endfunction let s:input = getline(1, '$') enew put =s:main(s:input) 2,$print