結果
問題 | No.3 ビットすごろく |
ユーザー | Common Lisp |
提出日時 | 2024-11-04 12:20:54 |
言語 | Common Lisp (sbcl 2.3.8) |
結果 |
AC
|
実行時間 | 13 ms / 5,000 ms |
コード長 | 1,491 bytes |
コンパイル時間 | 407 ms |
コンパイル使用メモリ | 35,504 KB |
実行使用メモリ | 32,316 KB |
最終ジャッジ日時 | 2024-11-04 12:20:57 |
合計ジャッジ時間 | 2,433 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 11 ms
28,136 KB |
testcase_01 | AC | 10 ms
28,140 KB |
testcase_02 | AC | 10 ms
28,136 KB |
testcase_03 | AC | 11 ms
28,004 KB |
testcase_04 | AC | 10 ms
28,008 KB |
testcase_05 | AC | 11 ms
28,136 KB |
testcase_06 | AC | 10 ms
28,136 KB |
testcase_07 | AC | 11 ms
30,172 KB |
testcase_08 | AC | 11 ms
28,136 KB |
testcase_09 | AC | 11 ms
28,136 KB |
testcase_10 | AC | 13 ms
30,300 KB |
testcase_11 | AC | 12 ms
28,136 KB |
testcase_12 | AC | 11 ms
28,136 KB |
testcase_13 | AC | 12 ms
30,172 KB |
testcase_14 | AC | 11 ms
28,392 KB |
testcase_15 | AC | 13 ms
28,392 KB |
testcase_16 | AC | 12 ms
28,268 KB |
testcase_17 | AC | 13 ms
30,300 KB |
testcase_18 | AC | 11 ms
28,136 KB |
testcase_19 | AC | 12 ms
28,264 KB |
testcase_20 | AC | 11 ms
32,192 KB |
testcase_21 | AC | 10 ms
28,268 KB |
testcase_22 | AC | 12 ms
32,316 KB |
testcase_23 | AC | 11 ms
28,136 KB |
testcase_24 | AC | 11 ms
28,264 KB |
testcase_25 | AC | 12 ms
28,264 KB |
testcase_26 | AC | 11 ms
32,216 KB |
testcase_27 | AC | 11 ms
30,172 KB |
testcase_28 | AC | 12 ms
28,264 KB |
testcase_29 | AC | 12 ms
30,172 KB |
testcase_30 | AC | 10 ms
28,132 KB |
testcase_31 | AC | 10 ms
30,172 KB |
testcase_32 | AC | 11 ms
28,136 KB |
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 04 NOV 2024 12:20:54 PM): ; wrote /home/judge/data/code/Main.fasl ; compilation finished in 0:00:00.012
ソースコード
(defun main (&rest argv) (declare (ignorable argv)) (let* ((n (read)) (dist (make-array 10001 :initial-element 0)) (visited (make-array 10001 :initial-element nil)) (deque (make-array 400000 :element-type 'integer)) (front-index 200000) (rear-index 200000)) (setf (aref visited 1) t) (setf (aref deque rear-index) 1 rear-index (1+ rear-index)) (loop while (< front-index rear-index) do (let* ((p 0) (x (aref deque front-index)) (m x)) (incf front-index) (loop while (/= m 0) do (incf p (logand m 1)) (setf m (ash m -1))) (let ((ip (+ x p)) (im (- x p))) (when (and (<= ip n) (not (aref visited ip))) (setf (aref visited ip) t (aref dist ip) (1+ (aref dist x)) (aref deque rear-index) ip rear-index (1+ rear-index))) (when (and (> im 0) (not (aref visited im))) (setf (aref visited im) t (aref dist im) (1+ (aref dist x)) (aref deque rear-index) im rear-index (1+ rear-index)))))) (format t "~d~%" (if (aref visited n) (1+ (aref dist n)) -1)))) (main)