結果
問題 | No.2009 Drunkers' Contest |
ユーザー | n_get |
提出日時 | 2022-07-15 22:34:13 |
言語 | Scheme (Gauche-0.9.14) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,597 bytes |
コンパイル時間 | 160 ms |
コンパイル使用メモリ | 6,688 KB |
実行使用メモリ | 44,556 KB |
最終ジャッジ日時 | 2024-06-27 19:22:44 |
合計ジャッジ時間 | 26,211 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 44 ms
19,072 KB |
testcase_01 | AC | 45 ms
19,072 KB |
testcase_02 | AC | 43 ms
18,944 KB |
testcase_03 | AC | 44 ms
19,072 KB |
testcase_04 | AC | 43 ms
19,200 KB |
testcase_05 | AC | 44 ms
19,072 KB |
testcase_06 | AC | 44 ms
19,072 KB |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | AC | 44 ms
19,072 KB |
testcase_10 | WA | - |
testcase_11 | AC | 44 ms
18,944 KB |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | AC | 50 ms
19,584 KB |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | AC | 670 ms
44,508 KB |
testcase_26 | WA | - |
testcase_27 | AC | 677 ms
44,388 KB |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | AC | 674 ms
44,400 KB |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | WA | - |
testcase_37 | WA | - |
testcase_38 | WA | - |
testcase_39 | WA | - |
testcase_40 | WA | - |
testcase_41 | WA | - |
testcase_42 | WA | - |
testcase_43 | WA | - |
testcase_44 | AC | 630 ms
44,368 KB |
testcase_45 | AC | 620 ms
44,324 KB |
testcase_46 | AC | 575 ms
44,276 KB |
testcase_47 | AC | 555 ms
44,312 KB |
testcase_48 | AC | 547 ms
44,508 KB |
testcase_49 | WA | - |
testcase_50 | WA | - |
testcase_51 | WA | - |
testcase_52 | WA | - |
testcase_53 | WA | - |
testcase_54 | WA | - |
testcase_55 | WA | - |
testcase_56 | WA | - |
testcase_57 | WA | - |
ソースコード
(use util.queue)(use util.match)(use gauche.collection)(use gauche.sequence) (define-syntax def-syntax (syntax-rules()((_ v e ...)(define-syntax v (syntax-rules e ...))))) (define-syntax def-const define-constant)(define-syntax def define)(define-syntax def-inline define-inline) (def-syntax def-names ()((_[x y]...)(begin(define-constant x y)...))) (def-names [// quotient][% modulo][v-make make-vector][v-ref vector-ref][v-set! vector-set!][ht-make make-hash-table][ht-ref hash-table-get][ht-set! hash-table-put!][ht-keys hash-table-keys][ht-values hash-table-values][q-make make-queue][make-q make-queue][enq! enqueue!][deq! dequeue!][q-empty? queue-empty?]) (def-syntax input (: list vec cons str) ((_ : cons e ...)(cons(input : e ...)(input : e ...)))((_ : list str)(input : string->list str)) ((_ : vec str)(input : string->vector str))((_ : vec n e ...)(vector-tabulate n(^_(input : e ...)))) ((_ : list n e ...)(let l([k n])(if(zero? k)'()(cons(input : e ...)(l(- k 1))))))((_ :)(read))((_ : : e)e) ((_ : str)(let1 s(read-line)(if(string=? s "")(read-line)s)))((_[[v]: e ...])(def v(input : e ...))) ((_[[v w ...]: e ...])(begin(def v(input : e ...))(input[[w ...]: e ...]))) ((_[v : e ...])(def v(input : e ...)))((_ : op e ...)(op(input : e ...))) ((_(e ...))(e ...))((_ v)(def v(read)))((_ e ...)(begin(input e)...))) (define-constant *MOD* 1000000007) ;(define-constant *MOD* 998244353) (def-syntax add-mod! ()((_ v x)(let1 y(+ v x)(set! v(if(< y *MOD*)y(- y *MOD*)))))) (def-inline(v-add-mod! v i x)(let1 y(+(v-ref v i)x)(v-set! v i(if(< y *MOD*)y(- y *MOD*))))) (def-syntax max! ()((_ v x)(set! v (max x v)))) (def-syntax min! ()((_ v x)(set! v (min x v)))) (def-inline(v-add! v i x)(v-set! v i(+ x(v-ref v i)))) (def-inline(ht-add! ht i x)(ht-set! ht i(+ x(ht-ref ht i 0)))) (def-inline(ht-cons! ht i x)(ht-set! ht i(cons x(ht-ref ht i '())))) (def-syntax return () ((_ e ...) (begin (print e ...) (exit)))) ;; 以下スニペットのコピペ ;; 以下が本体 (input N [[A B] : vec N]) (def asum (make-vector N 0)) (def bsum (make-vector N 0)) (let loop[[i (- N 1)] [a (v-ref A (- N 1))] [b (v-ref B (- N 1))]] (v-set! asum i a) (v-set! bsum i b) (unless (zero? i) (loop (- i 1) (+ a (v-ref A (- i 1))) (+ b (v-ref B (- i 1)))))) (def (culc-x A B) (sqrt (/ (exact->inexact A) B))) (def (culc-t x A B) (+ (/ A x) (* B x))) (def ans 0.0) (def x 1.0) (dotimes [i N] (set! x (max x (min (culc-x (v-ref A i) (v-ref B i)) (culc-x (v-ref asum i) (v-ref bsum i))))) (inc! ans (culc-t x (v-ref A i) (v-ref B i)))) (print ans)