QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#293455 | #5. 在线 O(1) 逆元 | iee | 100 ✓ | 5907ms | 394504kb | C++14 | 400b | 2023-12-29 10:26:01 | 2024-11-05 21:56:43 |
Judging History
answer
#pragma GCC optimize("O3,Ofast,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#include <bits/stdc++.h>
using namespace std;
constexpr int P = 998244353, N = 1e8;
int v[N];
void init(int p) {
v[1] = 1;
for (int i = 2; i < N; i++) {
v[i] = 1ll * v[P % i] * (P - P / i) % P;
}
}
int inv(int x) {
if (x < N) return v[x];
return 1ll * inv(P % x) * (P - P / x) % P;
}
Details
Pretests
Final Tests
Test #1:
score: 10
Accepted
time: 760ms
memory: 394352kb
Test #2:
score: 20
Accepted
time: 1280ms
memory: 394316kb
Test #3:
score: 30
Accepted
time: 3354ms
memory: 394432kb
Test #4:
score: 20
Accepted
time: 4886ms
memory: 394500kb
Test #5:
score: 20
Accepted
time: 5907ms
memory: 394504kb