QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#489112#5. 在线 O(1) 逆元qwef_60 4605ms394524kbC++14267b2024-07-24 18:07:432024-11-05 22:01:55

Judging History

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

  • [2024-11-05 22:01:55]
  • 管理员手动重测本题所有提交记录
  • 测评结果:60
  • 用时:4605ms
  • 内存:394524kb
  • [2024-07-24 18:07:43]
  • 评测
  • 测评结果:70
  • 用时:1446ms
  • 内存:394488kb
  • [2024-07-24 18:07:43]
  • 提交

answer

#include "inv.h"
typedef long long ll;
const int N=1e8+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: 10
Accepted
time: 837ms
memory: 394500kb

Test #2:

score: 20
Accepted
time: 1621ms
memory: 394524kb

Test #3:

score: 30
Accepted
time: 4605ms
memory: 394412kb

Test #4:

score: 0
Time Limit Exceeded

Test #5:

score: 0
Time Limit Exceeded