QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#102596 | #5. 在线 O(1) 逆元 | liuzhenhao09 | 70 | 2443ms | 394144kb | C++20 | 343b | 2023-05-03 14:55:32 | 2023-05-03 14:55:35 |
Judging History
answer
#include<bits/stdc++.h>
#include "inv.h"
using namespace std;
const int MOD = 998244353;
int iv[100000010];
int inv(int x){
if(x <= 100000000) return iv[x];
return 1LL * inv(MOD % x) * (MOD - MOD / x) % MOD;
}
void init(int p){
iv[1] = 1;
for(int i = 2; i <= 100000000; i++) iv[i] = 1LL * (MOD - MOD / i) * iv[MOD % i] % MOD;
}
Details
Test #1:
score: 30
Accepted
time: 1250ms
memory: 394144kb
Test #2:
score: 40
Accepted
time: 2443ms
memory: 394132kb
Test #3:
score: 0
Time Limit Exceeded