QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#241565#5. 在线 O(1) 逆元Endline0 693ms394256kbC++14380b2023-11-06 11:47:302023-11-06 11:47:32

Judging History

你现在查看的是测评时间为 2023-11-06 11:47:32 的历史记录

  • [2024-11-05 21:55:05]
  • 管理员手动重测本题所有提交记录
  • 测评结果:0
  • 用时:711ms
  • 内存:394540kb
  • [2023-11-06 11:47:32]
  • 评测
  • 测评结果:0
  • 用时:693ms
  • 内存:394256kb
  • [2023-11-06 11:47:30]
  • 提交

answer

#include<bits/stdc++.h>
#include"inv.h"
#define MAXN 100000002
using namespace std;
const int mod=998244353;
int now,Inv[MAXN];
int calc(int x,int mod)
{
	if(x<=now)return Inv[x];
	return (mod-mod/x)*calc(mod%x,mod)%mod;
}
void init(int p)
{
	Inv[1]=1,now=1;
	for(int i=2;i<=100000000;i++)
		Inv[i]=calc(i,mod),now=i;	
}
int inv(int x)
{
	return calc(x,mod);
}

Details

Test #1:

score: 0
Wrong Answer
time: 693ms
memory: 394256kb

Test #2:

score: 0
Wrong Answer
time: 683ms
memory: 394012kb

Test #3:

score: 0
Wrong Answer
time: 692ms
memory: 394080kb