結果
問題 | No.1512 作文 |
ユーザー | motoshira |
提出日時 | 2021-05-21 22:28:32 |
言語 | Common Lisp (sbcl 2.3.8) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,568 bytes |
コンパイル時間 | 1,689 ms |
コンパイル使用メモリ | 35,636 KB |
実行使用メモリ | 71,996 KB |
最終ジャッジ日時 | 2024-04-18 16:01:53 |
合計ジャッジ時間 | 2,941 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | AC | 10 ms
26,152 KB |
testcase_02 | AC | 11 ms
26,152 KB |
testcase_03 | AC | 10 ms
26,156 KB |
testcase_04 | AC | 93 ms
55,652 KB |
testcase_05 | AC | 98 ms
53,484 KB |
testcase_06 | AC | 131 ms
53,608 KB |
testcase_07 | AC | 97 ms
55,652 KB |
testcase_08 | AC | 93 ms
55,520 KB |
testcase_09 | AC | 18 ms
37,104 KB |
testcase_10 | AC | 18 ms
35,088 KB |
testcase_11 | AC | 17 ms
36,980 KB |
testcase_12 | AC | 18 ms
33,168 KB |
testcase_13 | AC | 18 ms
33,188 KB |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | AC | 10 ms
26,536 KB |
testcase_22 | AC | 10 ms
26,284 KB |
testcase_23 | AC | 11 ms
26,540 KB |
testcase_24 | AC | 11 ms
26,660 KB |
testcase_25 | WA | - |
testcase_26 | AC | 11 ms
30,120 KB |
testcase_27 | AC | 10 ms
30,244 KB |
testcase_28 | AC | 10 ms
30,240 KB |
testcase_29 | WA | - |
testcase_30 | AC | 9 ms
26,280 KB |
testcase_31 | AC | 11 ms
26,284 KB |
testcase_32 | AC | 10 ms
26,536 KB |
testcase_33 | AC | 10 ms
30,392 KB |
testcase_34 | AC | 13 ms
31,052 KB |
testcase_35 | AC | 30 ms
39,320 KB |
testcase_36 | AC | 30 ms
41,096 KB |
testcase_37 | AC | 27 ms
35,092 KB |
testcase_38 | WA | - |
testcase_39 | WA | - |
testcase_40 | WA | - |
testcase_41 | AC | 66 ms
68,076 KB |
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 18 APR 2024 04:01:48 PM): ; wrote /home/judge/data/code/Main.fasl ; compilation finished in 0:00:00.061
ソースコード
(declaim (inline println)) (defun println (obj &optional (stream *standard-output*)) (let ((*read-default-float-format* 'double-float)) (prog1 obj (princ obj stream) (terpri stream)))) (defun ok (xs) (sb-int:named-let rec ((xs xs) (c #\a)) (or (null xs) (and (char<= c (first xs)) (rec (rest xs) (first xs)))))) (defun get-l-and-r (xs) (when (ok xs) (list (length xs) (first (sort (copy-seq xs) #'char<)) (first (sort (copy-seq xs) #'char>))))) (define-modify-macro maxf (var) max) (defun char->int (c) (- (char-code c) (char-code #\a))) (defun main () (let* ((n (read)) (ss (sort (remove-if #'null (mapcar #'get-l-and-r (loop repeat n collect (concatenate 'list (read-line))))) #'(lambda (xs ys) (if (char= (second xs) (second ys)) (char< (third xs) (third ys)) (char< (second xs) (second ys))))))) (let ((dp (make-array 26 :initial-element 0))) (loop for (cnt l r) in ss do (maxf (aref dp (char->int r)) (+ (aref dp (char->int l)) cnt))) (println (reduce #'max dp))))) #-swank (main)