結果
| 問題 | 
                            No.519 アイドルユニット
                             | 
                    
| コンテスト | |
| ユーザー | 
                             Common Lisp
                         | 
                    
| 提出日時 | 2024-11-14 21:24:12 | 
| 言語 | Common Lisp  (sbcl 2.5.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 366 ms / 1,000 ms | 
| コード長 | 830 bytes | 
| コンパイル時間 | 271 ms | 
| コンパイル使用メモリ | 35,856 KB | 
| 実行使用メモリ | 161,968 KB | 
| 最終ジャッジ日時 | 2024-11-14 21:24:17 | 
| 合計ジャッジ時間 | 4,547 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 34 | 
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 14 NOV 2024 09:24:12 PM): ; wrote /home/judge/data/code/Main.fasl ; compilation finished in 0:00:00.019
ソースコード
(defun main (&rest argv)
  (declare (ignorable argv))
  (let* ((n (read))
         (f (make-array (list n n) :element-type 'integer))
         (s 0)
         (dp (make-array (ash 1 n) :element-type 'integer :initial-element -1)))
    (dotimes (i n)
      (dotimes (j n)
        (setf (aref f i j) (read))))
    (setf (aref dp 0) 0)
    (dotimes (i (ash 1 n))
      (when (>= (aref dp i) 0)
            (dotimes (j n)
              (when (zerop (logand i (ash 1 j)))
                    (setq s j)
                    (return)))
            (loop for j from (1+ s) below n
                  when (zerop (logand i (ash 1 j)))
                    do (setf (aref dp (logior i (ash 1 s) (ash 1 j))) (max (aref dp (logior i (ash 1 s) (ash 1 j))) (+ (aref dp i) (aref f s j)))))))
    (format t "~d~%" (aref dp (1- (ash 1 n))))))
(main)
            
            
            
        
            
Common Lisp