結果
問題 | No.147 試験監督(2) |
ユーザー | mkawa2 |
提出日時 | 2020-01-23 01:00:45 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 985 bytes |
コンパイル時間 | 98 ms |
コンパイル使用メモリ | 11,024 KB |
実行使用メモリ | 17,184 KB |
最終ジャッジ日時 | 2023-09-25 00:17:04 |
合計ジャッジ時間 | 7,089 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | TLE | - |
testcase_01 | -- | - |
testcase_02 | -- | - |
testcase_03 | -- | - |
ソースコード
import sys sys.setrecursionlimit(10 ** 6) int1 = lambda x: int(x) - 1 p2D = lambda x: print(*x, sep="\n") def II(): return int(sys.stdin.readline()) def MI(): return map(int, sys.stdin.readline().split()) def LI(): return list(map(int, sys.stdin.readline().split())) def LLI(rows_number): return [LI() for _ in range(rows_number)] def SI(): return sys.stdin.readline()[:-1] md = 10 ** 9 + 7 def mul(aa, bb): res = [0] * 3 for i, a in enumerate(aa): for j, b in enumerate(bb): res[i + j] += a * b res[0] += res[2] res[1] += res[2] res[0] %= md res[1] %= md return res[:2] def f(n): f0 = [1, 0] f1 = [0, 1] f2 = [1, 1] if n & 1: res = f1 else: res=f0 while n: n >>= 1 if n & 1: res = mul(res, f2) f2 = mul(f2, f2) return res[0]*1+res[1]*2 % md def main(): n=II() ans=1 for _ in range(n): c,d=MI() ans*=pow(f(c),d,md) ans%=md print(ans) main()