結果
| 問題 |
No.1025 Modular Equation
|
| コンテスト | |
| ユーザー |
convexineq
|
| 提出日時 | 2020-04-10 23:23:41 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 629 bytes |
| コンパイル時間 | 185 ms |
| コンパイル使用メモリ | 82,228 KB |
| 実行使用メモリ | 270,928 KB |
| 最終ジャッジ日時 | 2024-09-16 01:01:42 |
| 合計ジャッジ時間 | 7,760 ms |
|
ジャッジサーバーID (参考情報) |
judge6 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | WA * 6 TLE * 1 -- * 25 |
ソースコード
# coding: utf-8
# Your code here!
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
read = sys.stdin.read
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 = mm = 3<<30
for _ in range(n):
m << 96
m += mm
pa = (1 << 30) - ((1 << 30) % MOD)
for ai in a:
y = 0
for i,c in enumerate(lst):
if c!=0:
y += c<<(i*ai%p*96)
#print(bin(y)[2:])
x = x*y
x = (x>>(NUM)) + (x&ALL)
x -= ((x & m) >> 96) * pa
ans = (x>>(b*96))&((1<<32)-1)
print(ans%MOD)
convexineq