結果
問題 | No.895 MESE |
ユーザー | MiyamonY |
提出日時 | 2019-09-28 21:23:37 |
言語 | Scheme (Gauche-0.9.14) |
結果 |
TLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 1,507 bytes |
コンパイル時間 | 211 ms |
コンパイル使用メモリ | 6,816 KB |
実行使用メモリ | 30,256 KB |
最終ジャッジ日時 | 2024-10-03 04:15:18 |
合計ジャッジ時間 | 34,645 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 111 ms
21,248 KB |
testcase_01 | AC | 113 ms
21,248 KB |
testcase_02 | AC | 113 ms
21,316 KB |
testcase_03 | AC | 111 ms
21,376 KB |
testcase_04 | AC | 115 ms
21,316 KB |
testcase_05 | AC | 112 ms
21,448 KB |
testcase_06 | AC | 112 ms
21,248 KB |
testcase_07 | AC | 111 ms
21,316 KB |
testcase_08 | AC | 121 ms
21,440 KB |
testcase_09 | AC | 129 ms
21,572 KB |
testcase_10 | AC | 131 ms
21,444 KB |
testcase_11 | AC | 130 ms
21,696 KB |
testcase_12 | AC | 121 ms
21,504 KB |
testcase_13 | AC | 820 ms
24,008 KB |
testcase_14 | AC | 1,954 ms
28,028 KB |
testcase_15 | TLE | - |
testcase_16 | AC | 1,283 ms
27,532 KB |
testcase_17 | AC | 295 ms
22,720 KB |
testcase_18 | TLE | - |
testcase_19 | TLE | - |
testcase_20 | TLE | - |
testcase_21 | TLE | - |
testcase_22 | TLE | - |
testcase_23 | TLE | - |
testcase_24 | TLE | - |
testcase_25 | TLE | - |
testcase_26 | TLE | - |
testcase_27 | TLE | - |
testcase_28 | TLE | - |
ソースコード
;;; 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+ a . b) (fold (lambda (x acc) (modulo (+ x acc) MOD)) a b)) (define (mod* a . b) (fold (lambda (x acc) (modulo (* x acc) MOD)) a b)) (define (make-comb num) (define dp (make-vector num -1)) (define (fact n) (vector-ref dp n)) (vector-set! dp 0 1) (let loop ((i 1)) (when (< i num) (vector-set! dp i (mod* i (vector-ref dp (1- i)))) (loop (1+ i)))) (lambda (n k) (define factn (fact n)) (define powk (expt-mod (fact k) (- MOD 2) MOD)) (define pownk (expt-mod (fact (- n k)) (- MOD 2) MOD)) (mod* factn powk pownk))) (define (solve) (define comb (make-comb (* 3 100001))) (read-number (a b c)) (print (apply mod+ (map (lambda (i) (mod* (comb (- (+ a b c) i 2) (- c 1)) (comb (- (+ a b) i 1) (- b 1)) (1- (expt-mod 2 (- (+ a b c) i 1) MOD)))) (iota a 1))))) (solve)