QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#293458#5. 在线 O(1) 逆元iee70 ✓1362ms394196kbC++14303b2023-12-29 10:29:442023-12-29 10:29:45

Judging History

你现在查看的是测评时间为 2023-12-29 10:29:45 的历史记录

  • [2024-11-05 21:56:54]
  • 管理员手动重测本题所有提交记录
  • 测评结果:100
  • 用时:5539ms
  • 内存:394464kb
  • [2023-12-29 10:29:45]
  • 评测
  • 测评结果:70
  • 用时:1362ms
  • 内存:394196kb
  • [2023-12-29 10:29: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] = P - 1ll * v[P % i] * (P / i) % P;
	}
}
int inv(int x) {
	if (x < N) return v[x];
	return P - 1ll * inv(P % x) * (P / x) % P;
}

Details

Test #1:

score: 30
Accepted
time: 799ms
memory: 394184kb

Test #2:

score: 40
Accepted
time: 1362ms
memory: 394196kb

Test #3:

score: 0
Time Limit Exceeded