QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#23827#5. 在线 O(1) 逆元feecle641880 ✓5387ms160148kbC++20322b2022-03-19 16:35:482024-11-05 21:43:06

Judging History

你现在查看的是测评时间为 2024-11-05 21:43:06 的历史记录

  • [2024-11-05 21:46:34]
  • 管理员手动重测本题所有提交记录
  • 测评结果:100
  • 用时:5991ms
  • 内存:160132kb
  • [2024-11-05 21:43:06]
  • 管理员手动重测本题所有提交记录
  • 测评结果:80
  • 用时:5387ms
  • 内存:160148kb
  • [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:19:58]
  • 评测
  • 测评结果:70
  • 用时:1816ms
  • 内存:159884kb
  • [2022-03-19 16:35:48]
  • 提交

answer

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

Details


Pretests


Final Tests

Test #1:

score: 10
Accepted
time: 504ms
memory: 160148kb

Test #2:

score: 20
Accepted
time: 1124ms
memory: 160032kb

Test #3:

score: 30
Accepted
time: 3690ms
memory: 160148kb

Test #4:

score: 20
Accepted
time: 5387ms
memory: 160032kb

Test #5:

score: 0
Time Limit Exceeded