QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#850057 | #5. 在线 O(1) 逆元 | mnbvcxz123 | 10 | 43ms | 8436kb | C++23 | 404b | 2025-01-09 20:02:29 | 2025-01-09 20:02:30 |
Judging History
answer
#include"inv.h"
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
constexpr int mod=998244353;
map<int,int>mp;
ll exp(ll a, ll w){
ll ret=1;
a%=mod;
while(w){
if(w&1)ret=ret*a%mod;
a=a*a%mod;
w>>=1;
}
return ret;
}
void init(int p){}
int inv(int x){
if(mp.count(x))return mp[x];
return mp[x]=exp(x,mod-2);
}
Details
Pretests
Final Tests
Test #1:
score: 10
Accepted
time: 43ms
memory: 8436kb
Test #2:
score: 0
Time Limit Exceeded
Test #3:
score: 0
Time Limit Exceeded
Test #4:
score: 0
Time Limit Exceeded
Test #5:
score: 0
Time Limit Exceeded