結果

問題 No.1025 Modular Equation
ユーザー convexineqconvexineq
提出日時 2020-04-10 23:15:06
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 672 bytes
コンパイル時間 258 ms
コンパイル使用メモリ 10,936 KB
実行使用メモリ 18,868 KB
最終ジャッジ日時 2023-10-14 04:50:08
合計ジャッジ時間 8,489 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,820 KB
testcase_01 AC 17 ms
7,752 KB
testcase_02 AC 29 ms
8,768 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 TLE -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

# coding: utf-8
# Your code here!
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
read = sys.stdin.read

def FastConvolution(A,B): # A,B: 2^c 成分を想定
    return ifft(fft(A)*fft(B))

p,n,k,b,*a = [int(i) for i in read().split()]


lst = [0]*p
for i in range(p): lst[pow(i,k,p)] += 1

MOD = 10**9+7


x = 1
M = 1<<96
NUM = 96*p
ALL = (1<<NUM)-1
m = int(("1" * 2 + "0" * 30) * p, 2)
pa = (1 << 30) - ((1 << 30) % MOD)

for ai in a:
    y = 0
    for i,c in enumerate(lst):
        y += c<<(i*ai%p*96)
    #print(bin(y)[2:])
    x = x*y
    x = (x>>(NUM))+ (x&ALL)
    x -= ((x & m) >> 30) * pa
    

ans = (x>>(b*96))&((1<<32)-1)
print(ans%MOD)
0