結果
問題 | No.2561 みんな大好きmod 998 |
ユーザー | Common Lisp |
提出日時 | 2024-11-05 22:33:26 |
言語 | Common Lisp (sbcl 2.3.8) |
結果 |
RE
|
実行時間 | - |
コード長 | 1,128 bytes |
コンパイル時間 | 212 ms |
コンパイル使用メモリ | 37,772 KB |
実行使用メモリ | 35,992 KB |
最終ジャッジ日時 | 2024-11-05 22:33:29 |
合計ジャッジ時間 | 2,476 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | RE | - |
testcase_01 | RE | - |
testcase_02 | RE | - |
testcase_03 | RE | - |
testcase_04 | RE | - |
testcase_05 | RE | - |
testcase_06 | RE | - |
testcase_07 | RE | - |
testcase_08 | RE | - |
testcase_09 | RE | - |
testcase_10 | RE | - |
testcase_11 | RE | - |
testcase_12 | RE | - |
testcase_13 | RE | - |
testcase_14 | RE | - |
testcase_15 | RE | - |
testcase_16 | RE | - |
testcase_17 | RE | - |
testcase_18 | RE | - |
testcase_19 | RE | - |
testcase_20 | RE | - |
testcase_21 | RE | - |
testcase_22 | RE | - |
testcase_23 | RE | - |
testcase_24 | RE | - |
testcase_25 | RE | - |
testcase_26 | RE | - |
testcase_27 | RE | - |
testcase_28 | RE | - |
testcase_29 | RE | - |
testcase_30 | RE | - |
testcase_31 | RE | - |
testcase_32 | RE | - |
testcase_33 | RE | - |
testcase_34 | RE | - |
testcase_35 | RE | - |
testcase_36 | RE | - |
testcase_37 | RE | - |
testcase_38 | RE | - |
testcase_39 | RE | - |
testcase_40 | RE | - |
testcase_41 | RE | - |
testcase_42 | RE | - |
testcase_43 | RE | - |
testcase_44 | RE | - |
testcase_45 | RE | - |
testcase_46 | RE | - |
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 05 NOV 2024 10:33:26 PM): ; wrote /home/judge/data/code/Main.fasl ; compilation finished in 0:00:00.016
ソースコード
(defun vector-append (vec1 vec2) (let ((len1 (length vec1)) (len2 (length vec2))) (let ((result (make-array (+ len1 len2) :element-type (array-element-type vec1)))) (dotimes (i len1) (setf (aref result i) (aref vec1 i))) (dotimes (i len2) (setf (aref result (+ i len1)) (aref vec2 i))) result))) (defun combinations (vec k) (if (= k 0) (vector) (when (not (zerop (length vec))) (let ((first (aref vec 0)) (rest (subseq vec 1))) (let ((with-first (mapcar (lambda (x) (vector first x)) (combinations rest (1- k))))) (vector-append with-first (combinations rest k))))))) (defun main (&rest argv) (declare (ignorable argv)) (let* ((n (read)) (k (read)) (a (make-array n)) (res 0) (m1 998) (m2 998244353)) (dotimes (i n) (setf (aref a i) (read))) (loop for i across (combinations a k) with s = (reduce #'+ i) when (>= (mod s m1) (mod s m2)) do (incf res)) (format t "~d~%" (mod res m1)))) (main)