QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#293453#5. 在线 O(1) 逆元iee70 ✓1408ms394420kbC++14303b2023-12-29 10:24:442023-12-29 10:24:44

Judging History

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

  • [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

Test #1:

score: 30
Accepted
time: 781ms
memory: 394060kb

Test #2:

score: 40
Accepted
time: 1408ms
memory: 394420kb

Test #3:

score: 0
Time Limit Exceeded