結果

問題 No.48 ロボットの操縦
ユーザー mikan-watermikan-water
提出日時 2024-01-16 21:16:51
言語 Common Lisp
(sbcl 2.3.8)
結果
WA  
実行時間 -
コード長 1,423 bytes
コンパイル時間 891 ms
コンパイル使用メモリ 39,024 KB
実行使用メモリ 29,216 KB
最終ジャッジ日時 2024-01-16 21:16:57
合計ジャッジ時間 2,117 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 10 ms
29,216 KB
testcase_01 AC 10 ms
29,216 KB
testcase_02 AC 8 ms
29,216 KB
testcase_03 AC 9 ms
29,216 KB
testcase_04 AC 8 ms
29,216 KB
testcase_05 WA -
testcase_06 AC 8 ms
29,216 KB
testcase_07 AC 9 ms
29,216 KB
testcase_08 AC 8 ms
29,216 KB
testcase_09 AC 9 ms
29,216 KB
testcase_10 AC 9 ms
29,216 KB
testcase_11 AC 9 ms
29,216 KB
testcase_12 AC 9 ms
29,216 KB
testcase_13 AC 8 ms
29,216 KB
testcase_14 AC 8 ms
29,216 KB
testcase_15 AC 9 ms
29,216 KB
testcase_16 AC 8 ms
29,216 KB
testcase_17 AC 9 ms
29,216 KB
testcase_18 AC 9 ms
29,216 KB
testcase_19 AC 8 ms
29,216 KB
testcase_20 AC 8 ms
29,216 KB
testcase_21 AC 9 ms
29,216 KB
testcase_22 AC 8 ms
29,216 KB
testcase_23 AC 8 ms
29,216 KB
testcase_24 AC 8 ms
29,216 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 16 JAN 2024 12:16:51 PM):

; file: /home/judge/data/code/Main.lisp
; in: DEFUN FIRST_CHECK
;     (RETURN-FROM N48 0)
; 
; caught ERROR:
;   return for unknown block: N48
; 
; compilation unit finished
;   caught 1 ERROR condition


; wrote /home/judge/data/code/Main.fasl
; compilation finished in 0:00:00.041

ソースコード

diff #

; variables

; 0:N, 1:E, 2:S, 3:W
(defparameter *direction* 0)
(defparameter *x* 0)
(defparameter *y* 0)
(defparameter *k* 1)

(defvar *upper* (expt 10 9))
(defvar *lower* (* -1 (expt 10 9)))

;functions
(defun check_xyk ()
  (cond
    ((or
       (or (> *x* *upper*) (< *x* *lower*))
       (or (> *y* *upper*) (< *y* *lower*))
       (or (> *k* *upper*) (< *k* 1)))
     (print "NO"))
    (t (print "YES"))
    )
  )

(defun xy_quadrant (x y)
  (cond
    ((and (> x 0) (> y 0)) 1)
    ((and (< x 0) (> y 0)) 2)
    ((and (< x 0) (< y 0)) 3)
    ((and (> x 0) (< y 0)) 4)
    (t nil))
  )

(defun number_adv_1d (x k)
  (cond
    ((= x 0) 0)
    ((< (abs x) k) 1)
    ((= (mod x k) 0) (abs (/ x k)))
    (t (1+ (abs (truncate x k)))))
  )

(defun number_advance (x y k)
  (+ (number_adv_1d x k)
     (number_adv_1d y k))
  )

(defun number_rotate (x y quadrant)
  (cond
    ((= x 0)
     (if (> y 0)
       0
       2))
    ((= y 0) 1)
    (t
      (case quadrant
	(1 1)
	(2 1)
	(3 2)
	(4 2))
      ))
  )

(defun number_order (x y k quadrant)
  (+ (number_advance x y k)
     (number_rotate x y quadrant))
  )

(defun first_check (x y)
  (cond
    ((and (= x 0) (= y 0))
     (return-from n48 0))
    (t nil))
  )

(defun n48 ()
  (setf *x* (parse-integer (read-line)))
  (setf *y* (parse-integer (read-line)))
  (setf *k* (parse-integer (read-line)))
  (princ (number_order *x* *y* *k* (xy_quadrant *x* *y*)))
  )

(n48)
0