QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#328238#5. 在线 O(1) 逆元NOI_AK_MECompile Error//C++20818b2024-02-15 18:28:542024-11-05 21:57:37

Judging History

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

  • [2024-11-05 21:57:37]
  • 管理员手动重测本题所有提交记录
  • [2024-02-15 18:29:59]
  • 评测
  • [2024-02-15 18:28:54]
  • 提交

answer

#pragma once
#pragma GCC optimize("Ofast, unroll-loops")
#include "inv.h"
#define int unsigned
int a[3035136], g[974849];
int inv(int x) {
	const int p = (unsigned long long) x * g[x >> 10] % 998244353;
	return (unsigned long long) g[x >> 10] * (p < 3035136 ? a[p] : 998244353 - a[998244353 - p]) % 998244353;
}
int getinv(int x) {
    return x == 1 ? 1 : 974849 - (unsigned long long)(974849 / x) * getinv(974849 % x) % 974849;
}
void init(int) {
	for(int i = 987;i;--i) {
		int inv = getinv(i);
		for(int j = 1;j <= 987;++j) {
			g[(unsigned long long) j * inv % 974849] = i;
			g[974849 - (unsigned long long) j * inv % 974849] = 998244353 - i;
		}
	}
	g[0] = a[1] = 1;
	for(int i = 2;i ^ 3035136;++i)
		a[i] = 998244353 - (unsigned long long)(998244353 / i) * a[998244353 % i] % 998244353;
}

详细

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:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
answer.code:2:43: warning: bad option ‘-f unroll-loops’ to pragma ‘optimize’ [-Wpragmas]
    2 | #pragma GCC optimize("Ofast, unroll-loops")
      |                                           ^
In file included from answer.code:3:
inv.h:1:16: warning: bad option ‘-f unroll-loops’ to attribute ‘optimize’ [-Wattributes]
    1 | void init(int p);
      |                ^
inv.h:1:16: warning: bad option ‘-f unroll-loops’ to attribute ‘optimize’ [-Wattributes]
inv.h:2:14: warning: bad option ‘-f unroll-loops’ to attribute ‘optimize’ [-Wattributes]
    2 | int inv(int n);
      |              ^
inv.h:2:14: warning: bad option ‘-f unroll-loops’ to attribute ‘optimize’ [-Wattributes]
answer.code:6:14: warning: bad option ‘-f unroll-loops’ to attribute ‘optimize’ [-Wattributes]
    6 | int inv(int x) {
      |              ^
answer.code:10:17: warning: bad option ‘-f unroll-loops’ to attribute ‘optimize’ [-Wattributes]
   10 | int getinv(int x) {
      |                 ^
answer.code:13:14: warning: bad option ‘-f unroll-loops’ to attribute ‘optimize’ [-Wattributes]
   13 | void init(int) {
      |              ^
/usr/bin/ld: /tmp/ccseaY9M.o: in function `main':
implementer.cpp:(.text.startup+0x12b): undefined reference to `init(int)'
/usr/bin/ld: implementer.cpp:(.text.startup+0x1d0): undefined reference to `inv(int)'
collect2: error: ld returned 1 exit status