QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#293455#5. 在线 O(1) 逆元iee100 ✓5907ms394504kbC++14400b2023-12-29 10:26:012024-11-05 21:56:43

Judging History

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

  • [2024-11-05 21:56:43]
  • 管理员手动重测本题所有提交记录
  • 测评结果:100
  • 用时:5907ms
  • 内存:394504kb
  • [2023-12-29 10:26:01]
  • 评测
  • 测评结果:70
  • 用时:1351ms
  • 内存:394256kb
  • [2023-12-29 10:26:01]
  • 提交

answer

#pragma GCC optimize("O3,Ofast,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#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: 760ms
memory: 394352kb

Test #2:

score: 20
Accepted
time: 1280ms
memory: 394316kb

Test #3:

score: 30
Accepted
time: 3354ms
memory: 394432kb

Test #4:

score: 20
Accepted
time: 4886ms
memory: 394500kb

Test #5:

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