結果

問題 No.182 新規性の虜
ユーザー まんしmaNNshi
提出日時 2025-04-05 22:03:55
言語 Common Lisp
(sbcl 2.5.0)
結果
AC  
実行時間 79 ms / 5,000 ms
コード長 636 bytes
コンパイル時間 623 ms
コンパイル使用メモリ 31,848 KB
実行使用メモリ 40,320 KB
最終ジャッジ日時 2025-04-05 22:03:58
合計ジャッジ時間 2,884 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 05 APR 2025 10:03:55 PM):

; file: /home/judge/data/code/Main.lisp
; in: WITH-HASH-TABLE-ITERATOR (NEXT RENSOU)
;     (MULTIPLE-VALUE-BIND (MORE KEY VAL)
;         (NEXT)
;       (UNLESS MORE (RETURN))
;       (IF (= VAL 1)
;           (INCF CNT)))
; ==>
;   #'(LAMBDA (&OPTIONAL MORE KEY VAL &REST #:IGNORE)
;       (DECLARE (IGNORE #:IGNORE))
;       (UNLESS MORE (RETURN))
;       (IF (= VAL 1)
;           (INCF CNT)))
; 
; caught STYLE-WARNING:
;   The variable KEY 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.125

ソースコード

diff #

(defvar N)
(defvar A)
(defvar temp)
(setq N (parse-integer (read-line)))
(setq A (read-from-string (concatenate 'string "(" (read-line) ")")))

(defvar rensou)
(setq rensou (make-hash-table))
(loop for i in A do
    ;(print i)
    (if (gethash i rensou)
        (setf (gethash i rensou) (+ (gethash i rensou) 1))
        (setf (gethash i rensou) 1)
    )
)
;(print rensou)
(defvar cnt)
(setq cnt 0)
    (with-hash-table-iterator (next rensou)
  (loop
    (multiple-value-bind (more key val) (next)
      (unless more (return))
      (if (= val 1) (incf cnt)))))
      ;(format t "Key: ~a, Value: ~a~%" key val))))

(format t "~d~%" cnt)
0