QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#268030 | #5. 在线 O(1) 逆元 | David713 | 0 | 833ms | 277308kb | C++14 | 402b | 2023-11-27 23:00:35 | 2024-11-05 21:55:55 |
Judging History
answer
#include "inv.h"
#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353, N = 7e7 + 5;
typedef long long ll;
int invv[N];
void init(int p)
{
invv[0] = invv[1] = 1;
for (int i = 2; i <= 7e7; i++) invv[i] = ll((mod - mod / i) * invv[mod % i]) % mod;
}
int inv(int x)
{
if (x <= 7e7) return invv[x];
return ((ll)(mod - mod / x) * (ll)(inv(mod % x))) % mod;
}
Details
Pretests
Final Tests
Test #1:
score: 0
Wrong Answer
time: 820ms
memory: 277272kb
Test #2:
score: 0
Wrong Answer
time: 833ms
memory: 277308kb
Test #3:
score: 0
Wrong Answer
time: 825ms
memory: 277084kb
Test #4:
score: 0
Wrong Answer
time: 751ms
memory: 277084kb
Test #5:
score: 0
Wrong Answer
time: 755ms
memory: 277284kb