結果

問題 No.147 試験監督(2)
ユーザー kimiyukikimiyuki
提出日時 2016-02-27 10:22:43
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 596 bytes
コンパイル時間 562 ms
コンパイル使用メモリ 11,856 KB
実行使用メモリ 18,824 KB
最終ジャッジ日時 2023-10-24 18:25:08
合計ジャッジ時間 7,867 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
mod = int(1e9+7)
def fib(n):
    def mul(a, b):
        c = [[0,0],[0,0]]
        for y in range(2):
            for z in range(2):
                for x in range(2):
                    c[y][x] = (c[y][x] + a[y][z] * b[z][x] % mod) % mod
        return c
    f = [[1,0],[0,1]]
    e = [[1,1],[1,0]]
    i = 0
    while (1<<i) <= n:
        if n & (1<<i):
            f = mul(f, e)
        e = mul(e, e)
        i += 1
    return f[0][0]
n = int(input())
ans = 1
for i in range(n):
    c, d = map(int,input().split())
    ans = ans * pow(fib(c+1), d, mod) % mod
print(ans)
0