QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#293459#5. 在线 O(1) 逆元iee80 5113ms394504kbC++14312b2023-12-29 10:31:082024-11-05 21:56:58

Judging History

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

  • [2024-11-05 21:56:58]
  • 管理员手动重测本题所有提交记录
  • 测评结果:80
  • 用时:5113ms
  • 内存:394504kb
  • [2023-12-29 10:31:10]
  • 评测
  • 测评结果:70
  • 用时:1399ms
  • 内存:394416kb
  • [2023-12-29 10:31:08]
  • 提交

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 (register 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;
}

詳細信息


Pretests


Final Tests

Test #1:

score: 10
Accepted
time: 727ms
memory: 394452kb

Test #2:

score: 20
Accepted
time: 1484ms
memory: 394364kb

Test #3:

score: 30
Accepted
time: 3517ms
memory: 394384kb

Test #4:

score: 20
Accepted
time: 5113ms
memory: 394504kb

Test #5:

score: 0
Time Limit Exceeded