QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#641199#5. 在线 O(1) 逆元Idtwtei0 30ms19140kbC++14281b2024-10-14 19:08:532024-10-14 19:08:59

Judging History

你现在查看的是测评时间为 2024-10-14 19:08:59 的历史记录

  • [2024-11-05 22:06:30]
  • 管理员手动重测本题所有提交记录
  • 测评结果:0
  • 用时:21ms
  • 内存:19148kb
  • [2024-10-14 19:08:59]
  • 评测
  • 测评结果:0
  • 用时:30ms
  • 内存:19140kb
  • [2024-10-14 19:08:53]
  • 提交

answer

#include"inv.h"
#include<bits/stdc++.h>
using namespace std;

const int MOD=998244353,N=MOD>>8;
int I[N];

void init(int p){ I[1]=1; for(int i=1;i<N;++i) I[i]=MOD-1ll*(MOD/i)*I[MOD%i]%MOD; }
int inv(int x){
	if(x<N) return I[x];
	return MOD-1ll*(MOD/x)*inv(MOD%x)%MOD;
}

Details


Pretests


Final Tests

Test #1:

score: 0
Wrong Answer
time: 24ms
memory: 19064kb

Test #2:

score: 0
Wrong Answer
time: 19ms
memory: 19140kb

Test #3:

score: 0
Wrong Answer
time: 30ms
memory: 18992kb