結果
問題 | No.2790 Athena 3 |
ユーザー |
|
提出日時 | 2024-06-22 17:05:25 |
言語 | Common Lisp (sbcl 2.5.0) |
結果 |
AC
|
実行時間 | 11 ms / 2,000 ms |
コード長 | 1,037 bytes |
コンパイル時間 | 488 ms |
コンパイル使用メモリ | 37,352 KB |
実行使用メモリ | 31,892 KB |
最終ジャッジ日時 | 2024-06-22 17:05:26 |
合計ジャッジ時間 | 1,510 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 14 |
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 22 JUN 2024 05:05:24 PM): ; wrote /home/judge/data/code/Main.fasl ; compilation finished in 0:00:00.077
ソースコード
(defun read-points ()(list (read) (read) (read) (read) (read) (read)))(defun calculate-area (x1 y1 x2 y2 x3 y3)(/ (abs (- (+ (* x1 (- y2 y3)) (* x2 (- y3 y1)) (* x3 (- y1 y2))))) 2.0))(defun max-triangle-area (points)(let* ((x1 (nth 0 points))(y1 (nth 1 points))(x2 (nth 2 points))(y2 (nth 3 points))(x3 (nth 4 points))(y3 (nth 5 points))(deltas '((1 0) (-1 0) (0 1) (0 -1)))(max-area 0.0))(dolist (d1 deltas)(dolist (d2 deltas)(dolist (d3 deltas)(let* ((new-x1 (+ x1 (car d1)))(new-y1 (+ y1 (cadr d1)))(new-x2 (+ x2 (car d2)))(new-y2 (+ y2 (cadr d2)))(new-x3 (+ x3 (car d3)))(new-y3 (+ y3 (cadr d3)))(area (calculate-area new-x1 new-y1 new-x2 new-y2 new-x3 new-y3)))(setf max-area (max max-area area))))))max-area))(let ((points (read-points)))(format t "~f~%" (max-triangle-area points)))