結果
問題 | No.870 無敵囲い |
ユーザー | ducktail |
提出日時 | 2019-08-30 21:53:39 |
言語 | Scheme (Gauche-0.9.14) |
結果 |
AC
|
実行時間 | 19 ms / 300 ms |
コード長 | 1,109 bytes |
コンパイル時間 | 59 ms |
コンパイル使用メモリ | 5,324 KB |
実行使用メモリ | 13,704 KB |
最終ジャッジ日時 | 2023-09-11 16:11:24 |
合計ジャッジ時間 | 1,637 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 18 ms
11,652 KB |
testcase_01 | AC | 18 ms
11,580 KB |
testcase_02 | AC | 18 ms
11,624 KB |
testcase_03 | AC | 18 ms
11,568 KB |
testcase_04 | AC | 18 ms
11,572 KB |
testcase_05 | AC | 18 ms
11,844 KB |
testcase_06 | AC | 19 ms
11,876 KB |
testcase_07 | AC | 18 ms
11,596 KB |
testcase_08 | AC | 18 ms
11,600 KB |
testcase_09 | AC | 19 ms
11,716 KB |
testcase_10 | AC | 18 ms
11,652 KB |
testcase_11 | AC | 18 ms
11,852 KB |
testcase_12 | AC | 18 ms
13,676 KB |
testcase_13 | AC | 19 ms
11,640 KB |
testcase_14 | AC | 18 ms
11,856 KB |
testcase_15 | AC | 19 ms
11,804 KB |
testcase_16 | AC | 19 ms
11,732 KB |
testcase_17 | AC | 19 ms
13,704 KB |
testcase_18 | AC | 18 ms
11,680 KB |
testcase_19 | AC | 19 ms
11,820 KB |
testcase_20 | AC | 18 ms
11,676 KB |
ソースコード
(define (read-list n) (cond [(zero? n) '()] [else (let* ([x1 (read)] [y1 (read)] [x2 (read)] [y2 (read)]) (cons (list x1 y1 x2 y2) (read-list (- n 1))))])) (define (solve ll) (let loop ([xa 2] [ya 8] [xb 3] [yb 9] [xc 7] [yc 9] [ll ll]) (cond [(null? ll) (if (and (= xa 5) (= ya 8) (= xb 4) (= yb 8) (= xc 6) (= yc 8)) "YES" "NO")] [else (let ([x1 (car (car ll))] [y1 (cadr (car ll))] [x2 (caddr (car ll))] [y2 (cadddr (car ll))]) (cond [(and (= x1 xa) (= y1 ya)) (loop x2 y2 xb yb xc yc (cdr ll))] [(and (= x1 xb) (= y1 yb)) (loop xa ya x2 y2 xc yc (cdr ll))] [(and (= x1 xc) (= y1 yc)) (loop xa ya xb yb x2 y2 (cdr ll))] [else (loop xa ya xb yb xc yc (cdr ll))]))]))) (define (main args) (let* ([n (read)] [ll (read-list n)]) (print (solve ll))) 0)