結果
問題 | No.147 試験監督(2) |
ユーザー | pluto77 |
提出日時 | 2019-11-21 14:06:34 |
言語 | PyPy2 (7.3.15) |
結果 |
AC
|
実行時間 | 1,108 ms / 2,000 ms |
コード長 | 605 bytes |
コンパイル時間 | 1,815 ms |
コンパイル使用メモリ | 76,716 KB |
実行使用メモリ | 81,692 KB |
最終ジャッジ日時 | 2024-04-18 02:19:02 |
合計ジャッジ時間 | 7,210 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1,108 ms
81,692 KB |
testcase_01 | AC | 1,092 ms
81,324 KB |
testcase_02 | AC | 1,062 ms
81,408 KB |
testcase_03 | AC | 77 ms
77,184 KB |
ソースコード
#yuki147 import sys def mul(x, y): l=[[0, 0], [0, 0]] for i in range(2): for j in range(2): for k in range(2): l[i][j]+=x[i][k]*y[k][j] l[i][j]%=mod return l def matpow(n): p=[[1, 1], [1, 0]] l=[[1, 0], [0, 1]] while n>0: if n%2: l=mul(l, p) p=mul(p, p) n/=2 return l mod=10**9+7 n=int(raw_input()) res=1 for i in range(n): c, d=map(int, raw_input().split()) x=matpow(c+2)[1][0] if x==0: print 0 sys.exit() res*=pow(x, d%(mod-1), mod) res%=mod print res