結果

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

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

ソースコード

diff #

(defun main (&rest argv)
  (declare (ignorable argv))
  (let* ((n (read))
         (k (read))
         (a (loop repeat n collect (read)))
         (b (sort (copy-list a) #'<))
         (x (nth (1- k) b))
         (l ()))
    (loop for i from 0 below n
          do (push (if (<= (nth i a) x) #\x #\o) l))
    (setf l (reverse l))
    (let ((ans ()))
      (loop for i from 0 below (1- n)
            when (and (char= (nth i l) #\x)
                      (char= (nth (1+ i) l) #\o))
            do (push (+ 2 i) ans))
      (format t "~a~%~{~a~^ ~}~%" (length ans) (reverse ans)))))
(main)
0