結果

問題 No.8044 April Sum of Odd
ユーザー Lisp_Coder
提出日時 2024-05-16 02:01:00
言語 Common Lisp
(sbcl 2.5.0)
結果
TLE  
実行時間 -
コード長 694 bytes
コンパイル時間 1,269 ms
コンパイル使用メモリ 34,860 KB
実行使用メモリ 54,412 KB
最終ジャッジ日時 2024-12-20 10:40:34
合計ジャッジ時間 8,678 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 8 TLE * 2
権限があれば一括ダウンロードができます
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 20 DEC 2024 10:40:25 AM):

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

ソースコード

diff #

(defun main ()
  (let* ((n (read))
         (m (read))
         (a (loop for i from 1 to n collect (read))))

    (let ((i 0))
      (loop while (< i n)
            do (when (oddp (nth i a))
                 (let ((ans (nth i a))
                       (ct 1)
                       (j (1+ i)))
                   (loop while (and (< j n) (oddp (nth j a)))
                         do (progn
                              (incf ct)
                              (incf ans (nth j a))
                              (incf j)))
                   (when (>= ct m)
                     (format t "~a~%" ans))
                   (setf i j)))
            (incf i)))))

;; Call the main function
(main)
0