結果
| 問題 |
No.2835 Take and Flip
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-08-09 23:13:35 |
| 言語 | Common Lisp (sbcl 2.5.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 856 bytes |
| コンパイル時間 | 286 ms |
| コンパイル使用メモリ | 37,436 KB |
| 実行使用メモリ | 54,352 KB |
| 最終ジャッジ日時 | 2024-08-09 23:13:42 |
| 合計ジャッジ時間 | 4,131 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 1 TLE * 1 -- * 20 |
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 09 AUG 2024 11:13:37 PM): ; wrote /home/judge/data/code/Main.fasl ; compilation finished in 0:00:00.008
ソースコード
#-swank
(unless (member :child-sbcl *features*)
(quit
:recklessly-p t
:unix-status
(process-exit-code
(run-program *runtime-pathname*
`("--control-stack-size" "1024MB"
"--noinform" "--disable-ldb" "--lose-on-corruption" "--end-runtime-options"
"--eval" "(push :child-sbcl *features*)"
"--script" ,(namestring *load-pathname*))
:output t :error t :input t))))
(defun solve-game ()
(let* ((n (read))
(a (sort (loop for i from 1 to n collect (read)) #'>))
(x 0)
(y 0)
(multiplier 1))
(loop for i from 0 below n do
(if (evenp i)
(incf x (* multiplier (nth i a)))
(incf y (* multiplier (nth i a))))
(setq multiplier (- multiplier)))
(format t "~d~%" (- x y))))
(solve-game)