結果
問題 | No.1025 Modular Equation |
ユーザー |
![]() |
提出日時 | 2020-04-10 23:18:03 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 694 bytes |
コンパイル時間 | 257 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 22,308 KB |
最終ジャッジ日時 | 2024-09-16 00:32:02 |
合計ジャッジ時間 | 8,040 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | WA * 6 TLE * 1 -- * 25 |
ソースコード
# coding: utf-8# Your code here!import syssys.setrecursionlimit(10**6)readline = sys.stdin.readlineread = sys.stdin.readdef 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]*pfor i in range(p): lst[pow(i,k,p)] += 1MOD = 10**9+7x = 1M = 1<<96NUM = 96*pALL = (1<<NUM)-1m = int(("1" * 2 + "0" * 30) * p, 2)pa = (1 << 30) - ((1 << 30) % MOD)for ai in a:y = 0for i,c in enumerate(lst):if c!=0:y += c<<(i*ai%p*96)#print(bin(y)[2:])x = x*yx = (x>>(NUM)) + (x&ALL)x -= ((x & m) >> 96) * paans = (x>>(b*96))&((1<<32)-1)print(ans%MOD)