QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#489114#5. 在线 O(1) 逆元qwef_70 1559ms499896kbC++14270b2024-07-24 18:10:202024-07-24 18:10:24

Judging History

你现在查看的是测评时间为 2024-07-24 18:10:24 的历史记录

  • [2024-11-05 22:01:56]
  • 管理员手动重测本题所有提交记录
  • 测评结果:60
  • 用时:4082ms
  • 内存:499908kb
  • [2024-07-24 18:10:24]
  • 评测
  • 测评结果:70
  • 用时:1559ms
  • 内存:499896kb
  • [2024-07-24 18:10:20]
  • 提交

answer

#include "inv.h"
typedef long long ll;
const int N=1.27e8+114,p=998244353;
int a[N];
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,j=(j+x>=p?j+x-p:j+x))
		if(j<N)
			return (ll)a[j]*i%p;
}

詳細信息


Pretests


Final Tests

Test #1:

score: 30
Accepted
time: 754ms
memory: 499784kb

Test #2:

score: 40
Accepted
time: 1559ms
memory: 499896kb

Test #3:

score: 0
Time Limit Exceeded