QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#489194#5. 在线 O(1) 逆元qwef_0 996ms515600kbC++23467b2024-07-24 18:52:582024-11-05 22:02:33

Judging History

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

  • [2024-11-05 22:02:33]
  • 管理员手动重测本题所有提交记录
  • 测评结果:0
  • 用时:996ms
  • 内存:515600kb
  • [2024-07-24 18:52:58]
  • 评测
  • 测评结果:0
  • 用时:906ms
  • 内存:515524kb
  • [2024-07-24 18:52:58]
  • 提交

answer

//#include <bits/stdc++.h>
#include "inv.h"
typedef long long ll;
const int N=1.31e8+114,p=998244353;
int a[N];
inline void add(int& a,int b){a=(a+b>=p?a+b-p:a+b);}
void init(int _){
	a[1]=1;
	for(int i=2;i<N;++i) a[i]=(ll)(p-p/i)*a[p%i]%p;
}
int inv(int x){
	for(int i=1,j=x;;++i,add(j,x))
		if(j<N)
			return (ll)inv[j]*i%p;
}
//int main(){
//	init(998244353);
//	int x;
//	std::cin >> x;
//	std::cout << query(x) << std::endl;
//	return 0;
//}

详细


Pretests


Final Tests

Test #1:

score: 0
Wrong Answer
time: 996ms
memory: 515520kb

Test #2:

score: 0
Wrong Answer
time: 972ms
memory: 515600kb

Test #3:

score: 0
Wrong Answer
time: 962ms
memory: 515584kb

Test #4:

score: 0
Wrong Answer
time: 975ms
memory: 515600kb

Test #5:

score: 0
Wrong Answer
time: 972ms
memory: 515468kb