QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#714086#5. 在线 O(1) 逆元lgx5760 4225ms23332kbC++14285b2024-11-05 21:36:402024-11-05 22:08:21

Judging History

This is the latest submission verdict.

  • [2024-11-05 22:08:21]
  • 管理员手动重测本题所有提交记录
  • Verdict: 60
  • Time: 4225ms
  • Memory: 23332kb
  • [2024-11-05 21:36:41]
  • Judged
  • Verdict: 70
  • Time: 929ms
  • Memory: 23376kb
  • [2024-11-05 21:36:40]
  • Submitted

answer

#include<bits/stdc++.h>
using namespace std;
const int mod=998244353;
const int N=5000000;
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: 34ms
memory: 23316kb

Test #2:

score: 20
Accepted
time: 843ms
memory: 23244kb

Test #3:

score: 30
Accepted
time: 4225ms
memory: 23332kb

Test #4:

score: 0
Time Limit Exceeded

Test #5:

score: 0
Time Limit Exceeded