結果
問題 | No.1892 Extended Fib Series |
ユーザー | yassu0320 |
提出日時 | 2022-04-02 00:39:52 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 141 ms / 2,000 ms |
コード長 | 1,612 bytes |
コンパイル時間 | 196 ms |
コンパイル使用メモリ | 82,108 KB |
実行使用メモリ | 81,312 KB |
最終ジャッジ日時 | 2024-11-20 19:48:50 |
合計ジャッジ時間 | 4,751 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 99 ms
79,960 KB |
testcase_01 | AC | 132 ms
81,144 KB |
testcase_02 | AC | 103 ms
79,804 KB |
testcase_03 | AC | 101 ms
79,924 KB |
testcase_04 | AC | 113 ms
80,860 KB |
testcase_05 | AC | 98 ms
79,928 KB |
testcase_06 | AC | 137 ms
81,312 KB |
testcase_07 | AC | 101 ms
80,808 KB |
testcase_08 | AC | 117 ms
81,004 KB |
testcase_09 | AC | 109 ms
81,092 KB |
testcase_10 | AC | 113 ms
80,640 KB |
testcase_11 | AC | 95 ms
79,944 KB |
testcase_12 | AC | 111 ms
80,636 KB |
testcase_13 | AC | 117 ms
80,988 KB |
testcase_14 | AC | 97 ms
79,944 KB |
testcase_15 | AC | 96 ms
79,732 KB |
testcase_16 | AC | 98 ms
79,904 KB |
testcase_17 | AC | 97 ms
79,840 KB |
testcase_18 | AC | 98 ms
80,032 KB |
testcase_19 | AC | 97 ms
79,980 KB |
testcase_20 | AC | 97 ms
79,960 KB |
testcase_21 | AC | 99 ms
79,740 KB |
testcase_22 | AC | 97 ms
79,768 KB |
testcase_23 | AC | 97 ms
79,804 KB |
testcase_24 | AC | 99 ms
79,796 KB |
testcase_25 | AC | 98 ms
79,960 KB |
testcase_26 | AC | 97 ms
79,900 KB |
testcase_27 | AC | 97 ms
80,140 KB |
testcase_28 | AC | 98 ms
79,832 KB |
testcase_29 | AC | 102 ms
81,084 KB |
testcase_30 | AC | 103 ms
81,176 KB |
testcase_31 | AC | 102 ms
81,140 KB |
testcase_32 | AC | 141 ms
81,248 KB |
ソースコード
#!/usr/bin/env pypy3 from pprint import pprint from string import ascii_lowercase as letter from sys import setrecursionlimit, stdin from typing import Dict, Iterable, Set try: import pypyjit pypyjit.set_param("max_unroll_recursion=-1") except ModuleNotFoundError: ... INF: int = (1 << 62) - 1 MOD1000000007 = 10**9 + 7 MOD998244353 = 998244353 setrecursionlimit(500_000) readline = stdin.readline input = lambda: stdin.readline().rstrip("\r\n") def inputs(type_=int): ins = input().split() if isinstance(type_, Iterable): return [t(x) for t, x in zip(type_, ins)] else: return list(map(type_, ins)) def input_(type_=int): (a, ) = inputs(type_) return a def input1() -> int: return int(readline()) inputi = input1 def input2(): a = readline().split() assert len(a) == 2 a[0] = int(a[0]) a[1] = int(a[1]) return a def input3(): a = readline().split() assert len(a) == 3 a[0] = int(a[0]) a[1] = int(a[1]) a[2] = int(a[2]) return a def input4(): a = readline().split() assert len(a) == 4 a[0] = int(a[0]) a[1] = int(a[1]) a[2] = int(a[2]) a[3] = int(a[3]) return a # start coding from typing import List, Optional n, l = input2() mod = MOD1000000007 if n < l: print(pow(2, n - 1, mod)) exit() a: List[Optional[int]] = [None] * (n + 1) a[0] = 1 for i in range(1, l): a[i] = pow(2, i - 1, mod) s = 0 for i in range(l): s += a[i] s %= mod for i in range(l, n + 1): a[i] = s s -= a[i - l] s += a[i] s %= mod # print(a) print(a[-1])