結果
問題 |
No.2757 Pin Game
|
ユーザー |
|
提出日時 | 2024-07-31 16:33:56 |
言語 | Common Lisp (sbcl 2.5.0) |
結果 |
AC
|
実行時間 | 267 ms / 2,000 ms |
コード長 | 381 bytes |
コンパイル時間 | 2,035 ms |
コンパイル使用メモリ | 35,244 KB |
実行使用メモリ | 36,800 KB |
最終ジャッジ日時 | 2024-07-31 16:34:01 |
合計ジャッジ時間 | 2,771 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 10 |
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 31 JUL 2024 04:33:56 PM): ; file: /home/judge/data/code/Main.lisp ; in: DEFUN MAX-PINS ; (DEFUN MAX-PINS (N K PINS) ; (LET ((COUNT 1) (LAST-PIN (FIRST PINS))) ; (DOLIST (PIN (REST PINS) COUNT) (WHEN (>= # K) (INCF COUNT) (SETF #))))) ; --> SB-IMPL::%DEFUN SB-IMPL::%DEFUN SB-INT:NAMED-LAMBDA ; ==> ; #'(SB-INT:NAMED-LAMBDA MAX-PINS ; (N K PINS) ; (DECLARE (SB-C::TOP-LEVEL-FORM)) ; (BLOCK MAX-PINS ; (LET ((COUNT 1) (LAST-PIN #)) ; (DOLIST (PIN # COUNT) (WHEN # # #))))) ; ; caught STYLE-WARNING: ; The variable N is defined but never used. ; ; compilation unit finished ; caught 1 STYLE-WARNING condition ; wrote /home/judge/data/code/Main.fasl ; compilation finished in 0:00:00.069
ソースコード
(defun max-pins (n k pins) (let ((count 1) (last-pin (first pins))) (dolist (pin (rest pins) count) (when (>= (- pin last-pin) k) (incf count) (setf last-pin pin))))) (defun read-pins () (let ((n (read)) (k (read))) (let ((pins (loop for i from 1 to n collect (read)))) (format t "~d~%" (max-pins n k pins))))) (read-pins)