結果

問題 No.2774 Wake up Record 2
ユーザー Common Lisp
提出日時 2024-10-21 22:03:53
言語 Common Lisp
(sbcl 2.5.0)
結果
AC  
実行時間 118 ms / 2,000 ms
コード長 536 bytes
コンパイル時間 378 ms
コンパイル使用メモリ 41,996 KB
実行使用メモリ 32,904 KB
最終ジャッジ日時 2024-10-21 22:03:55
合計ジャッジ時間 2,242 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 16
権限があれば一括ダウンロードができます
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 21 OCT 2024 10:03:53 PM):

; wrote /home/judge/data/code/Main.fasl
; compilation finished in 0:00:00.024

ソースコード

diff #

(defun main (&rest argv)
  (declare (ignorable argv))
  (let* ((n (read))
         (k (read))
         (a (make-array n))
         (b (make-array (1+ n) :initial-element 10000000000)))
    (loop for i from 0 below n do
          (setf (aref a i) (read)))
    (setf b (sort (copy-seq a) #'<))
    (let ((x (aref b (1- k)))
          (c ()))
      (loop for i from 1 below n
            when (and (> (aref a i) x) (<= (aref a (1- i)) x))
            do (push (1+ i) c))
      (format t "~a~%~{~a~^ ~}~%" (length c) (reverse c)))))
(main)
0