QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#293460#5. 在线 O(1) 逆元ieeCompile Error//C++14392b2023-12-29 10:31:522024-11-05 21:56:59

Judging History

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

  • [2024-11-05 21:56:59]
  • 管理员手动重测本题所有提交记录
  • [2023-12-29 10:31:53]
  • 评测
  • [2023-12-29 10:31:52]
  • 提交

answer

#pragma GCC optimize("O3,Ofast,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#include <inv.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

implementer.cpp: In function ‘int main()’:
implementer.cpp:22:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   22 |         scanf("%d", &n);
      |         ~~~~~^~~~~~~~~~
answer.code:3:10: fatal error: inv.h: No such file or directory
    3 | #include <inv.h>
      |          ^~~~~~~
compilation terminated.