結果
問題 | No.1359 [Zelkova 3rd Tune] 四人セゾン |
ユーザー |
![]() |
提出日時 | 2024-11-03 20:03:05 |
言語 | Common Lisp (sbcl 2.5.0) |
結果 |
AC
|
実行時間 | 1,240 ms / 2,000 ms |
コード長 | 1,400 bytes |
コンパイル時間 | 329 ms |
コンパイル使用メモリ | 41,732 KB |
実行使用メモリ | 37,008 KB |
最終ジャッジ日時 | 2024-11-03 20:04:12 |
合計ジャッジ時間 | 66,333 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 75 |
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 03 NOV 2024 08:03:05 PM): ; wrote /home/judge/data/code/Main.fasl ; compilation finished in 0:00:00.028
ソースコード
(defun %mod-expt (a n m)(let ((result 1))(loop while (> n 0)when (oddp n)do (setq result (mod (* result a) m))do (setq a (mod (* a a) m))(setq n (ash n -1)))result))(defun main (&rest argv)(declare (ignorable argv))(let* ((n (read))(k (read))(m (read))(p-arr (make-array n :element-type 'integer))(e-arr (make-array n :element-type 'integer))(a-arr (make-array n :element-type 'integer))(h-arr (make-array n :element-type 'integer))(res 0))(dotimes (i n) (setf (aref p-arr i) (read)))(dotimes (i n) (setf (aref e-arr i) (read)))(dotimes (i n) (setf (aref a-arr i) (read)))(dotimes (i n) (setf (aref h-arr i) (read)))(sort p-arr #'<)(sort e-arr #'<)(sort a-arr #'<)(sort h-arr #'<)(dotimes (i n)(incf res (%mod-expt (- (max(aref p-arr i)(aref e-arr i)(aref a-arr i)(aref h-arr i))(min(aref p-arr i)(aref e-arr i)(aref a-arr i)(aref h-arr i))) k m))(setf res (mod res m)))(format t "~d~%" res)))(main)