結果
問題 | No.1765 While Shining |
ユーザー | motoshira |
提出日時 | 2021-11-27 00:12:25 |
言語 | Common Lisp (sbcl 2.3.8) |
結果 |
AC
|
実行時間 | 95 ms / 2,000 ms |
コード長 | 2,035 bytes |
コンパイル時間 | 1,105 ms |
コンパイル使用メモリ | 32,012 KB |
実行使用メモリ | 37,752 KB |
最終ジャッジ日時 | 2023-09-12 05:45:10 |
合計ジャッジ時間 | 3,561 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge12 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 9 ms
23,028 KB |
testcase_01 | AC | 10 ms
25,116 KB |
testcase_02 | AC | 10 ms
23,004 KB |
testcase_03 | AC | 10 ms
23,092 KB |
testcase_04 | AC | 10 ms
23,072 KB |
testcase_05 | AC | 11 ms
29,196 KB |
testcase_06 | AC | 10 ms
23,112 KB |
testcase_07 | AC | 10 ms
23,072 KB |
testcase_08 | AC | 10 ms
25,092 KB |
testcase_09 | AC | 64 ms
33,624 KB |
testcase_10 | AC | 91 ms
35,644 KB |
testcase_11 | AC | 79 ms
29,984 KB |
testcase_12 | AC | 84 ms
34,068 KB |
testcase_13 | AC | 76 ms
29,968 KB |
testcase_14 | AC | 93 ms
32,040 KB |
testcase_15 | AC | 95 ms
35,760 KB |
testcase_16 | AC | 93 ms
35,664 KB |
testcase_17 | AC | 93 ms
34,076 KB |
testcase_18 | AC | 94 ms
37,752 KB |
testcase_19 | AC | 93 ms
32,100 KB |
testcase_20 | AC | 93 ms
31,992 KB |
testcase_21 | AC | 94 ms
32,012 KB |
testcase_22 | AC | 93 ms
32,020 KB |
testcase_23 | AC | 92 ms
32,012 KB |
testcase_24 | AC | 90 ms
32,104 KB |
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 12 SEP 2023 05:45:05 AM): ; processing (IN-PACKAGE #:CL-USER) ; processing (DECLAIM (OPTIMIZE # ...)) ; processing (DECLAIM (MUFFLE-CONDITIONS COMPILER-NOTE)) ; processing (DISABLE-DEBUGGER) ; processing (PUSHNEW :INLINE-GENERIC-FUNCION ...) ; processing (IN-PACKAGE #:CL-USER) ; processing (DECLAIM (INLINE PRINTLN)) ; processing (DEFUN PRINTLN ...) ; processing (DEFUN READ-INTO ...) ; processing (DEFUN MAIN ...) ; processing (MAIN) ; wrote /home/judge/data/code/Main.fasl ; compilation finished in 0:00:00.103
ソースコード
(in-package #:cl-user) ;;------------------------------Preferences------------------------------ (eval-when (:compile-toplevel :load-toplevel :execute) #+swank (declaim (optimize (speed 3) (safety 2))) #-swank (declaim (optimize (speed 3) (safety 0) (debug 0))) #+swank (load "~/ghq/github.com/motoshira/atcoder-submission/ac-tools/act.lisp") #+swank (ql:quickload :prove) #-swank (declaim (sb-ext:muffle-conditions sb-ext:compiler-note)) #-swank (sb-ext:disable-debugger) (pushnew :inline-generic-funcion *features*)) ;;---------------------------------Body--------------------------------- (in-package #:cl-user) (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 read-into (count &optional (result-type 'list) (reader #'read)) (coerce (loop :repeat count :collect (funcall reader)) result-type)) (defun main () (let* ((n (read)) (as (read-into n 'vector)) (movable (make-array n :initial-element nil)) (next (make-array n :initial-element (1- n)))) (dotimes (i (1- n)) (when (and (plusp i) (= 1 (logxor (aref as i) (aref as (1- i))))) (setf (aref movable i) t))) (loop :for i :from (- n 2) :downto 0 :do (setf (aref next i) (if (aref movable i) (aref next (1+ i)) i))) (let ((res 0)) (dotimes (i (1- n)) (when (= 1 (aref as i)) (let ((dist (aref next (1+ i)))) (incf res (- dist i))))) (println res)))) #-swank (main) #+swank (defun run () (let ((*standard-input* (make-string-input-stream (with-output-to-string (*standard-output*) (run-program (merge-pathnames "copy-or-paste" (truename "~/bin/")) '() :output *standard-output*))))) (main)))