結果

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

テストケース

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

ソースコード

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)
    ((< x k) 1)
    ((= (mod x k) 0) (/ x k))
    (t (1+ (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