QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#738401 | #5. 在线 O(1) 逆元 | dqw | 80 | 5047ms | 42944kb | C++23 | 679b | 2024-11-12 18:58:21 | 2024-11-12 18:58:23 |
Judging History
answer
// __ __ _ _____ _ _ _____ ______ __
// \ \/ / / \|_ _| | | | | __ \ / __ \ \ /\ / /
// \ / / _ \ | | | | | | | | | | | | \ \ / \ / /
// / \ / ___ \| | | |_| | | |__| | |__| |\ V /\ V /
// /_/\_/_/ \_\_| \___/ |_____/ \___\_\ \_/ \_/ (TM)
#include <bits/stdc++.h>
#include "inv.h"
using namespace std;
#define ll long long
const int mod=998244353;
int invs[10000001];
void init(int p)
{
invs[1] = 1;
for (int i = 2; i <= 10000000; i++)
{
invs[i] = (mod - (ll)mod / i) * invs[mod % i] % mod;
}
}
int inv(int x)
{
if(x<=10000000)return invs[x];
return mod-(ll)mod/x*inv(mod%x)%mod;
}
详细
Pretests
Final Tests
Test #1:
score: 10
Accepted
time: 60ms
memory: 42844kb
Test #2:
score: 20
Accepted
time: 645ms
memory: 42900kb
Test #3:
score: 30
Accepted
time: 3200ms
memory: 42944kb
Test #4:
score: 20
Accepted
time: 5047ms
memory: 42768kb
Test #5:
score: 0
Time Limit Exceeded