結果

問題 No.1253 雀見椪
ユーザー proriboneproribone
提出日時 2020-10-10 14:04:06
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 314 ms / 2,000 ms
コード長 496 bytes
コンパイル時間 276 ms
コンパイル使用メモリ 86,984 KB
実行使用メモリ 78,212 KB
最終ジャッジ日時 2023-09-27 21:24:17
合計ジャッジ時間 5,129 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
71,224 KB
testcase_01 AC 73 ms
71,192 KB
testcase_02 AC 77 ms
71,000 KB
testcase_03 AC 114 ms
77,124 KB
testcase_04 AC 314 ms
77,956 KB
testcase_05 AC 299 ms
78,212 KB
testcase_06 AC 304 ms
78,200 KB
testcase_07 AC 304 ms
78,004 KB
testcase_08 AC 300 ms
78,004 KB
testcase_09 AC 300 ms
78,168 KB
testcase_10 AC 299 ms
77,784 KB
testcase_11 AC 297 ms
78,152 KB
testcase_12 AC 300 ms
77,792 KB
testcase_13 AC 300 ms
78,056 KB
testcase_14 AC 73 ms
71,284 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD=10**9+7

def solve():
    N,*arr=map(int,input().split())
    Ag,Bg,Ac,Bc,Ap,Bp=arr
    Cc=pow(Bc-Ac,N,MOD);Cg=pow(Bg-Ag,N,MOD);Cp=pow(Bp-Ap,N,MOD)
    Ag,Bg,Ac,Bc,Ap,Bp=map(lambda x:pow(x,N,MOD),arr)
    B=Bc*Bg*Bp%MOD
    A=0
    A=(A+Cc*Bg*Bp%MOD)%MOD
    A=(A+Cp*Bg*Bc%MOD)%MOD
    A=(A+Cg*Bc*Bp%MOD)%MOD
    r=(Ac*Bg*Bp%MOD+Ag*Bc*Bp%MOD+Ap*Bc*Bg%MOD)*2%MOD
    A=(A-r+MOD)%MOD
    A=(B-A+MOD)%MOD
    
    print(pow(B,MOD-2,MOD)*A%MOD)
    
T=int(input())

for _ in range(T):
    solve()
0