結果
問題 | No.2803 Bocching Star |
ユーザー |
|
提出日時 | 2024-07-21 01:03:46 |
言語 | Common Lisp (sbcl 2.5.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,272 bytes |
コンパイル時間 | 227 ms |
コンパイル使用メモリ | 39,572 KB |
実行使用メモリ | 46,080 KB |
最終ジャッジ日時 | 2024-07-21 01:03:50 |
合計ジャッジ時間 | 4,353 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | TLE * 1 -- * 34 |
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 21 JUL 2024 01:03:46 AM): ; wrote /home/judge/data/code/Main.fasl ; compilation finished in 0:00:00.012
ソースコード
#-swank (unless (member :child-sbcl *features*) (quit :recklessly-p t :unix-status (process-exit-code (run-program *runtime-pathname* `("--control-stack-size" "1024MB" "--noinform" "--disable-ldb" "--lose-on-corruption" "--end-runtime-options" "--eval" "(push :child-sbcl *features*)" "--script" ,(namestring *load-pathname*)) :output t :error t :input t)))) (defun main () (let* ((N (read)) (S (read)) (P (loop for i from 0 below N collect (read))) (index-pairs (loop for i from 0 below N collect (cons (nth i P) (1+ i)))) (sorted-pairs (stable-sort index-pairs #'< :key #'car)) (result '())) (loop for i from 0 below N for (value . index) = (nth i sorted-pairs) for left = (if (> i 0) (- value (car (nth (1- i) sorted-pairs))) most-positive-fixnum) for right = (if (< i (1- N)) (- (car (nth (1+ i) sorted-pairs)) value) most-positive-fixnum) for near = (min left right) when (> near S) do (push index result)) (setf result (sort result #'<)) (format t "~D~%" (length result)) (dolist (elem result) (format t "~D " elem)) (terpri))) (main)