結果
問題 | No.1 道のショートカット |
ユーザー | Common Lisp |
提出日時 | 2024-11-07 23:33:26 |
言語 | Common Lisp (sbcl 2.3.8) |
結果 |
AC
|
実行時間 | 15 ms / 5,000 ms |
コード長 | 1,444 bytes |
コンパイル時間 | 143 ms |
コンパイル使用メモリ | 37,632 KB |
実行使用メモリ | 22,272 KB |
最終ジャッジ日時 | 2024-11-07 23:33:28 |
合計ジャッジ時間 | 1,916 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 9 ms
21,760 KB |
testcase_01 | AC | 9 ms
21,760 KB |
testcase_02 | AC | 9 ms
21,760 KB |
testcase_03 | AC | 9 ms
21,760 KB |
testcase_04 | AC | 9 ms
21,760 KB |
testcase_05 | AC | 9 ms
21,760 KB |
testcase_06 | AC | 9 ms
21,760 KB |
testcase_07 | AC | 9 ms
21,888 KB |
testcase_08 | AC | 12 ms
22,144 KB |
testcase_09 | AC | 11 ms
21,888 KB |
testcase_10 | AC | 11 ms
22,016 KB |
testcase_11 | AC | 12 ms
22,144 KB |
testcase_12 | AC | 14 ms
22,272 KB |
testcase_13 | AC | 14 ms
22,144 KB |
testcase_14 | AC | 10 ms
21,760 KB |
testcase_15 | AC | 10 ms
21,888 KB |
testcase_16 | AC | 9 ms
22,016 KB |
testcase_17 | AC | 9 ms
21,760 KB |
testcase_18 | AC | 10 ms
21,760 KB |
testcase_19 | AC | 9 ms
21,888 KB |
testcase_20 | AC | 9 ms
21,760 KB |
testcase_21 | AC | 9 ms
22,016 KB |
testcase_22 | AC | 9 ms
21,888 KB |
testcase_23 | AC | 15 ms
22,016 KB |
testcase_24 | AC | 14 ms
22,144 KB |
testcase_25 | AC | 10 ms
21,760 KB |
testcase_26 | AC | 10 ms
21,888 KB |
testcase_27 | AC | 13 ms
22,016 KB |
testcase_28 | AC | 9 ms
21,760 KB |
testcase_29 | AC | 12 ms
22,016 KB |
testcase_30 | AC | 10 ms
21,760 KB |
testcase_31 | AC | 10 ms
21,888 KB |
testcase_32 | AC | 11 ms
22,016 KB |
testcase_33 | AC | 10 ms
21,888 KB |
testcase_34 | AC | 15 ms
22,016 KB |
testcase_35 | AC | 10 ms
21,888 KB |
testcase_36 | AC | 11 ms
22,016 KB |
testcase_37 | AC | 10 ms
21,760 KB |
testcase_38 | AC | 9 ms
21,760 KB |
testcase_39 | AC | 9 ms
21,888 KB |
testcase_40 | AC | 9 ms
21,760 KB |
testcase_41 | AC | 9 ms
21,760 KB |
testcase_42 | AC | 9 ms
21,888 KB |
testcase_43 | AC | 9 ms
21,888 KB |
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 07 NOV 2024 11:33:26 PM): ; wrote /home/judge/data/code/Main.fasl ; compilation finished in 0:00:00.056
ソースコード
(defconstant +inf+ 9876543210) (defun main (&rest argv) (declare (ignorable argv)) (let* ((n (read)) (c (read)) (v (read)) (ss (make-array v :element-type 'integer)) (tt (make-array v :element-type 'integer)) (yy (make-array v :element-type 'integer)) (mm (make-array v :element-type 'integer)) (dp (make-array (list n (1+ c)) :initial-element +inf+)) (graph (make-array n :element-type 'list :initial-element nil))) (dotimes (i v) (setf (aref ss i) (1- (read)))) (dotimes (i v) (setf (aref tt i) (1- (read)))) (dotimes (i v) (setf (aref yy i) (read))) (dotimes (i v) (setf (aref mm i) (read))) (dotimes (i v) (push (list (aref tt i) (aref yy i) (aref mm i)) (aref graph (aref ss i)))) (setf (aref dp 0 c) 0) (loop for i below (1- n) do (loop for j to c do (when (< (aref dp i j) +inf+) (dolist (pqr (aref graph i)) (let ((p (first pqr)) (q (second pqr)) (r (third pqr))) (when (>= (- j q) 0) (setf (aref dp p (- j q)) (min (aref dp p (- j q)) (+ r (aref dp i j)))))))))) (let ((res (loop for i to c minimize (aref dp (1- n) i)))) (format t "~d~%" (if (< res +inf+) res -1))))) (main)