QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#714072#5. 在线 O(1) 逆元lgx57100 ✓5936ms42972kbC++14286b2024-11-05 21:33:352024-11-05 22:08:19

Judging History

你现在查看的是最新测评结果

  • [2024-11-05 22:08:19]
  • 管理员手动重测本题所有提交记录
  • 测评结果:100
  • 用时:5936ms
  • 内存:42972kb
  • [2024-11-05 21:33:40]
  • 评测
  • 测评结果:70
  • 用时:655ms
  • 内存:42972kb
  • [2024-11-05 21:33:35]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int mod=998244353;
const int N=10000000;
int I[N];
void init(int p){
	I[1]=1;
	for (int i=2;i<N;i++) I[i]=mod-1ll*(mod/i)*I[mod%i]%mod;
}
int inv(int x){
	if (x<N) return I[x];
	else return mod-1ll*(mod/x)*inv(mod%x)%mod;
}

详细


Pretests


Final Tests

Test #1:

score: 10
Accepted
time: 52ms
memory: 42760kb

Test #2:

score: 20
Accepted
time: 640ms
memory: 42972kb

Test #3:

score: 30
Accepted
time: 2862ms
memory: 42968kb

Test #4:

score: 20
Accepted
time: 4530ms
memory: 42948kb

Test #5:

score: 20
Accepted
time: 5936ms
memory: 42952kb