QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#629285 | #5. 在线 O(1) 逆元 | 7_divided_by_3 | 0 | 0ms | 0kb | C++20 | 343b | 2024-10-11 10:16:37 | 2024-11-05 22:05:19 |
Judging History
answer
int invans[100000001];
int powp(int a,int b,int p)
{
int res=1;
a%=p;
while(b)
{
if(b&1)res=(1LL*res*a)%p;
a=(1LL*a*a)%p;
b>>=1;
}
return res;
}
void init(int p)
{
for(int i=1;i<=100000000;i++)
invans[i]=powp(i,p-2,p);
}
int inv(int x)
{
return invans[x];
}
Details
Pretests
Final Tests
Test #1:
score: 0
Time Limit Exceeded
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