結果
問題 | No.895 MESE |
ユーザー | MiyamonY |
提出日時 | 2019-09-28 23:12:11 |
言語 | Scheme (Gauche-0.9.14) |
結果 |
AC
|
実行時間 | 1,673 ms / 2,000 ms |
コード長 | 1,674 bytes |
コンパイル時間 | 130 ms |
コンパイル使用メモリ | 6,948 KB |
実行使用メモリ | 37,588 KB |
最終ジャッジ日時 | 2024-10-03 04:20:18 |
合計ジャッジ時間 | 42,102 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1,172 ms
21,752 KB |
testcase_01 | AC | 1,169 ms
22,520 KB |
testcase_02 | AC | 1,176 ms
22,884 KB |
testcase_03 | AC | 1,161 ms
21,764 KB |
testcase_04 | AC | 1,274 ms
23,120 KB |
testcase_05 | AC | 1,161 ms
23,008 KB |
testcase_06 | AC | 1,170 ms
21,884 KB |
testcase_07 | AC | 1,177 ms
22,620 KB |
testcase_08 | AC | 1,182 ms
22,532 KB |
testcase_09 | AC | 1,269 ms
22,600 KB |
testcase_10 | AC | 1,164 ms
22,392 KB |
testcase_11 | AC | 1,298 ms
22,748 KB |
testcase_12 | AC | 1,165 ms
22,672 KB |
testcase_13 | AC | 1,291 ms
28,032 KB |
testcase_14 | AC | 1,492 ms
37,532 KB |
testcase_15 | AC | 1,527 ms
37,420 KB |
testcase_16 | AC | 1,388 ms
31,156 KB |
testcase_17 | AC | 1,197 ms
25,760 KB |
testcase_18 | AC | 1,562 ms
37,388 KB |
testcase_19 | AC | 1,563 ms
37,432 KB |
testcase_20 | AC | 1,594 ms
37,588 KB |
testcase_21 | AC | 1,566 ms
37,420 KB |
testcase_22 | AC | 1,569 ms
37,372 KB |
testcase_23 | AC | 1,556 ms
37,576 KB |
testcase_24 | AC | 1,551 ms
37,568 KB |
testcase_25 | AC | 1,553 ms
37,472 KB |
testcase_26 | AC | 1,673 ms
37,500 KB |
testcase_27 | AC | 1,535 ms
37,396 KB |
testcase_28 | AC | 1,563 ms
37,396 KB |
ソースコード
;;; File: main.scm ;; Author: ymiyamoto ;; ;; Created on Sat Sep 28 20:04:17 2019 ;; (define-syntax read-number (syntax-rules () ((_ nums) (define-values nums (apply values (map string->number (string-split (read-line) #\space))))))) (define-syntax read-numbers (syntax-rules () ((_ as) (define as (map string->number (string-split (read-line) #\space)))) ((_ as n) (define as (map (lambda (_) (map string->number (string-split (read-line) #\space))) (iota n)))))) (define-syntax 1+ (syntax-rules () ((_ x) (+ x 1)))) (define-syntax 1- (syntax-rules () ((_ x) (- x 1)))) (define MOD 1000000007) (define (mod+ x y) (modulo (+ x y) MOD)) (define (mod* x y) (modulo (* x y) MOD)) (define (make-comb num) (define fact-dp (make-vector num -1)) (define inv-fact-dp (make-vector num -1)) (define (fact n) (vector-ref fact-dp n)) (define (inv-fact n) (vector-ref inv-fact-dp n)) (vector-set! fact-dp 0 1) (vector-set! inv-fact-dp 0 1) (let loop ((i 1)) (when (< i num) (vector-set! fact-dp i (mod* i (fact (- i 1)))) (vector-set! inv-fact-dp i (expt-mod (fact i) (- MOD 2) MOD)) (loop (+ i 1)))) (lambda (n k) (define factn (fact n)) (define powk (inv-fact k)) (define pownk (inv-fact (- n k))) (mod* (mod* factn powk) pownk))) (define (solve) (define comb (make-comb (* 3 100000))) (read-number (a b c)) (print (fold mod+ 0 (map (lambda (i) (define x (comb (- (+ a b c) i 2) (1- c))) (define y (comb (- (+ a b) i 1) (1- b))) (define z (1- (expt-mod 2 (- (+ a b c) i 1) MOD))) (mod* (mod* x y) z)) (iota a 1))))) (solve)