QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#23828#5. 在线 O(1) 逆元feecle641880 5467ms81988kbC++20378b2022-03-19 16:37:292024-11-05 21:46:34

Judging History

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

  • [2024-11-05 21:46:34]
  • 管理员手动重测本题所有提交记录
  • 测评结果:80
  • 用时:5467ms
  • 内存:81988kb
  • [2024-11-05 21:43:07]
  • 管理员手动重测本题所有提交记录
  • 测评结果:80
  • 用时:4862ms
  • 内存:81960kb
  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-04-30 04:20:13]
  • 评测
  • 测评结果:70
  • 用时:1504ms
  • 内存:81848kb
  • [2022-03-19 16:37:29]
  • 提交

answer

#include<bits/stdc++.h>
#include"inv.h"
using namespace std;
typedef long long ll;
const int mod=998244353;
int ny[20000005];
int inv(int x){
	if(x<=20000000)return ny[x];
	if(x>=mod-20000000)return mod-ny[mod-x];
	int t=mod/x;
	return 1ll*inv(mod-t*x)*(mod-t)%mod;
}
void init(int p){
	ny[1]=1;
	for(int i=2;i<=20000000;i++)ny[i]=1ll*ny[mod%i]*(mod-mod/i)%mod;
}

Details


Pretests


Final Tests

Test #1:

score: 10
Accepted
time: 213ms
memory: 81964kb

Test #2:

score: 20
Accepted
time: 866ms
memory: 81904kb

Test #3:

score: 30
Accepted
time: 3523ms
memory: 81988kb

Test #4:

score: 20
Accepted
time: 5467ms
memory: 81824kb

Test #5:

score: 0
Time Limit Exceeded