QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#624807 | #5. 在线 O(1) 逆元 | dww_1337 | 80 | 5002ms | 394328kb | C++14 | 324b | 2024-10-09 16:39:24 | 2024-11-05 22:04:46 |
Judging History
answer
#include "inv.h"
const int MAXN = 1e8 + 7;
const int MOD = 998244353;
int invt[MAXN];
void init(int p)
{
invt[1] = 1;
for(int i = 2 ; i < MAXN ; i++) invt[i] = p - 1ll * p / i * invt[p % i] % p;
}
int inv(int x)
{
if(x < MAXN) return invt[x];
else return MOD - 1ll * (MOD / x) * inv(MOD % x) % MOD;
}
詳細信息
Pretests
Final Tests
Test #1:
score: 10
Accepted
time: 986ms
memory: 394316kb
Test #2:
score: 20
Accepted
time: 1462ms
memory: 394296kb
Test #3:
score: 30
Accepted
time: 3514ms
memory: 394328kb
Test #4:
score: 20
Accepted
time: 5002ms
memory: 394300kb
Test #5:
score: 0
Time Limit Exceeded