QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#293453#5. 在线 O(1) 逆元iee100 ✓5788ms394524kbC++14303b2023-12-29 10:24:442024-11-05 21:56:40

Judging History

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

  • [2024-11-05 21:56:40]
  • 管理员手动重测本题所有提交记录
  • 测评结果:100
  • 用时:5788ms
  • 内存:394524kb
  • [2023-12-29 10:24:44]
  • 评测
  • 测评结果:70
  • 用时:1408ms
  • 内存:394420kb
  • [2023-12-29 10:24:44]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
constexpr int P = 998244353, N = 1e8;
int v[N];
void init(int p) {
	v[1] = 1;
	for (int i = 2; i < N; i++) {
		v[i] = 1ll * v[P % i] * (P - P / i) % P;
	}
}
int inv(int x) {
	if (x < N) return v[x];
	return 1ll * inv(P % x) * (P - P / x) % P;
}

Details


Pretests


Final Tests

Test #1:

score: 10
Accepted
time: 744ms
memory: 394336kb

Test #2:

score: 20
Accepted
time: 1269ms
memory: 394336kb

Test #3:

score: 30
Accepted
time: 3215ms
memory: 394324kb

Test #4:

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

Test #5:

score: 20
Accepted
time: 5788ms
memory: 394392kb