QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#217906#5. 在线 O(1) 逆元LGyxj60 3554ms42936kbC++14426b2023-10-17 15:53:162024-11-05 21:53:58

Judging History

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

  • [2024-11-05 21:53:58]
  • 管理员手动重测本题所有提交记录
  • 测评结果:60
  • 用时:3554ms
  • 内存:42936kb
  • [2023-10-17 15:53:17]
  • 评测
  • 测评结果:70
  • 用时:835ms
  • 内存:42692kb
  • [2023-10-17 15:53:16]
  • 提交

answer

#include "inv.h"
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
const int N = 1e7, mod = 998244353;
int invx[N];
int inv(int x) {
	int res = 1;
	while (x >= N) res = 1ll * res * (mod - mod / x) % mod, x = mod % x;
	return 1ll * res * invx[x] % mod;
}
void init(int p) {
	invx[1] = 1;
	for (int i = 2; i < N; ++ i) 
		invx[i] = 1ll * (mod - mod / i) * invx[mod % i] % mod;
	return;
}

Details


Pretests


Final Tests

Test #1:

score: 10
Accepted
time: 183ms
memory: 42932kb

Test #2:

score: 20
Accepted
time: 769ms
memory: 42828kb

Test #3:

score: 30
Accepted
time: 3554ms
memory: 42936kb

Test #4:

score: 0
Time Limit Exceeded

Test #5:

score: 0
Time Limit Exceeded