QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#136493#5. 在线 O(1) 逆元zhouhuanyi70 849ms42724kbC++14387b2023-08-08 21:04:542023-08-08 21:04:58

Judging History

你现在查看的是测评时间为 2023-08-08 21:04:58 的历史记录

  • [2024-11-05 21:51:30]
  • 管理员手动重测本题所有提交记录
  • 测评结果:60
  • 用时:4521ms
  • 内存:42956kb
  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-08-08 21:04:58]
  • 评测
  • 测评结果:70
  • 用时:849ms
  • 内存:42724kb
  • [2023-08-08 21:04:54]
  • 提交

answer

#include<iostream>
#include<cstdio>
#define mod 998244353
#define N 10000000
using namespace std;
int MD2(int x)
{
	return x<0?x+mod:x;
}
int T,invs[N+1];
void init(int p)
{
	invs[1]=1;
	for (int i=2;i<=N;++i) invs[i]=MD2(-1ll*(mod/i)*invs[mod%i]%mod);
	return;
}
int inv(int x)
{
	int a,b;
	if (x<=N) return invs[x];
	else return MD2(-1ll*(mod/x)*inv(mod%x)%mod);
}

Details

Test #1:

score: 30
Accepted
time: 81ms
memory: 42660kb

Test #2:

score: 40
Accepted
time: 849ms
memory: 42724kb

Test #3:

score: 0
Time Limit Exceeded