QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#293450#5. 在线 O(1) 逆元iee70 ✓1426ms394312kbC++17303b2023-12-29 10:21:002023-12-29 10:21:01

Judging History

This is a historical verdict posted at 2023-12-29 10:21:01.

  • [2024-11-05 21:56:34]
  • 管理员手动重测本题所有提交记录
  • Verdict: 100
  • Time: 5347ms
  • Memory: 394516kb
  • [2023-12-29 10:21:01]
  • Judged
  • Verdict: 70
  • Time: 1426ms
  • Memory: 394312kb
  • [2023-12-29 10:21:00]
  • Submitted

answer

#include <bits/stdc++.h>
using namespace std;
constexpr int N = 1e8, P = 998244353;
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;
}

詳細信息

Test #1:

score: 30
Accepted
time: 794ms
memory: 394124kb

Test #2:

score: 40
Accepted
time: 1426ms
memory: 394312kb

Test #3:

score: 0
Time Limit Exceeded