結果

問題 No.647 明太子
ユーザー ducktailducktail
提出日時 2018-03-01 15:26:11
言語 Scheme
(Gauche-0.9.14)
結果
AC  
実行時間 1,171 ms / 4,500 ms
コード長 1,322 bytes
コンパイル時間 135 ms
コンパイル使用メモリ 5,328 KB
実行使用メモリ 14,080 KB
最終ジャッジ日時 2023-09-09 09:38:02
合計ジャッジ時間 6,001 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 21 ms
12,416 KB
testcase_01 AC 21 ms
12,196 KB
testcase_02 AC 21 ms
12,188 KB
testcase_03 AC 21 ms
12,220 KB
testcase_04 AC 21 ms
12,268 KB
testcase_05 AC 22 ms
12,300 KB
testcase_06 AC 22 ms
12,192 KB
testcase_07 AC 22 ms
12,212 KB
testcase_08 AC 22 ms
12,232 KB
testcase_09 AC 34 ms
12,408 KB
testcase_10 AC 47 ms
12,476 KB
testcase_11 AC 26 ms
12,568 KB
testcase_12 AC 41 ms
12,452 KB
testcase_13 AC 69 ms
12,832 KB
testcase_14 AC 539 ms
13,904 KB
testcase_15 AC 94 ms
12,780 KB
testcase_16 AC 40 ms
12,412 KB
testcase_17 AC 671 ms
14,080 KB
testcase_18 AC 733 ms
13,908 KB
testcase_19 AC 279 ms
13,984 KB
testcase_20 AC 300 ms
13,912 KB
testcase_21 AC 118 ms
13,220 KB
testcase_22 AC 1,171 ms
13,916 KB
testcase_23 AC 23 ms
12,320 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

(define (main args)
  (let* [(n (read))
         (vab (vector-tabulate n (^_ (let* [(x (read))
                                            (y (read))]
                                       (cons x y)))))
         (m (read))
         (vxy (vector-tabulate m (^_ (let* [(a (read))
                                            (b (read))]
                                       (cons a b)))))
         (vc (make-vector m 0))]
    (let loop [(i 0)
               (j 0)]
      (cond [(= i n) #t]
            [(= j m) (loop (+ i 1) 0)]
            [else
      (let [(a (car (vector-ref vab i)))
            (b (cdr (vector-ref vab i)))
            (x (car (vector-ref vxy j)))
            (y (cdr (vector-ref vxy j)))]
        (cond [(and (>= a x) (<= b y)) (vector-set! vc j (+ 1 (vector-ref vc j)))])
        (loop i (+ j 1)))]))
    (for-each print
              (let loop [(i 0)
                         (mx 0)
                         (ls '())]
                (cond [(= i m) (if (null? ls) '(0) (reverse ls))]
                      [(zero? (vector-ref vc i)) (loop (+ i 1) mx ls)]
                      [(> (vector-ref vc i) mx) (loop (+ i 1) (vector-ref vc i) (list (+ i 1)))]
                      [(= (vector-ref vc i) mx) (loop (+ i 1) mx (cons (+ i 1) ls))]
                      [else (loop (+ i 1) mx ls)]))))
  0)
0