Submission #1868691
Source Code Expand
;;;mug24375826dev (define (_orange? ls v i) (not (and (member (vector-ref v i) ls) (member (vector-ref v (+ i 1)) ls)))) (define (orange? ls1 ls2 v i) (and (_orange? ls1 v i) (_orange? ls2 v i))) (define (check-edge ls1 ls2 v i) (if (or (member (vector-ref v i) ls2) (member (vector-ref v (+ i 1)) ls1)) (cons (vector-ref v (+ i 1)) (vector-ref v i)) (cons (vector-ref v i) (vector-ref v (+ i 1))))) (define (get-orange-edge v s i) (letrec ((loop (lambda (i count ls1 ls2) (cond ((= i (vector-length v)) (>= count (- (vector-ref v 0) 1))) ((orange? ls1 ls2 v i) (let ((edge-pair (check-edge ls1 ls2 v i))) (loop (+ i 2) (+ count 1) (cons (car edge-pair) ls1) (cons (cdr edge-pair) ls2)))) (else (loop (+ i 2) count ls1 ls2)))))) (loop i 1 (cons (vector-ref v s) '()) (cons (vector-ref v (+ s 1)) '())))) (define (_get-orange-patterns v) (letrec ((loop (lambda (patterns s i) (cond ((= s (vector-length v)) patterns) ((get-orange-edge v s i) (if (= i (vector-length v)) (loop (+ patterns 1) (+ s 2) (+ s 4)) (loop (+ patterns 1) s (+ i 2)))) (else (if (= i (vector-length v)) (loop patterns (+ s 2) (+ s 4)) (loop patterns s (+ i 2)))))))) (loop 0 2 4))) (define (get-orange-patterns v) (if (> (vector-ref v 0) (vector-ref v 1)) 1 (_get-orange-patterns v))) (define (orange-graph) (letrec ((loop (lambda (obj ls) (cond ((eof-object? obj) (print (get-orange-patterns (list->vector (reverse ls))))) (else (loop (read) (cons obj ls))))))) (loop (read) '()))) ;(orange-graph) (define v1 #(3 3 1 2 1 3 2 3)) (define v2 #(4 5 1 2 1 3 1 4 2 4 3 4)) (define v3 #(5 4 1 2 2 3 3 4 4 5)) (define v4 #(4 6 1 2 1 3 1 4 2 3 2 4 3 4))
Submission Info
Submission Time | |
---|---|
Task | C - Orange Graph |
User | mug24375826dev |
Language | Scheme (Gauche 0.9.3.3) |
Score | 0 |
Code Size | 1914 Byte |
Status | WA |
Exec Time | 44 ms |
Memory | 6364 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 100 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample_01.txt, sample_02.txt, sample_03.txt |
All | sample_01.txt, sample_02.txt, sample_03.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt, test_15.txt, test_16.txt, test_17.txt, test_18.txt, test_19.txt, test_20.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
sample_01.txt | WA | 44 ms | 6364 KB |
sample_02.txt | WA | 7 ms | 3068 KB |
sample_03.txt | WA | 7 ms | 3068 KB |
test_01.txt | WA | 7 ms | 3068 KB |
test_02.txt | WA | 7 ms | 3068 KB |
test_03.txt | WA | 7 ms | 3068 KB |
test_04.txt | WA | 7 ms | 3068 KB |
test_05.txt | WA | 7 ms | 3068 KB |
test_06.txt | WA | 7 ms | 3068 KB |
test_07.txt | WA | 7 ms | 3068 KB |
test_08.txt | WA | 7 ms | 3068 KB |
test_09.txt | WA | 7 ms | 3068 KB |
test_10.txt | WA | 7 ms | 3068 KB |
test_11.txt | WA | 7 ms | 3068 KB |
test_12.txt | WA | 7 ms | 3068 KB |
test_13.txt | WA | 7 ms | 3068 KB |
test_14.txt | WA | 7 ms | 3068 KB |
test_15.txt | WA | 7 ms | 3068 KB |
test_16.txt | WA | 7 ms | 3068 KB |
test_17.txt | WA | 7 ms | 3068 KB |
test_18.txt | WA | 7 ms | 3068 KB |
test_19.txt | WA | 7 ms | 3068 KB |
test_20.txt | WA | 7 ms | 3068 KB |