QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#479806 | #5. 在线 O(1) 逆元 | NOI_AK_ME# | Compile Error | / | / | C++23 | 841b | 2024-07-15 20:57:11 | 2024-11-05 22:00:41 |
Judging History
你现在查看的是最新测评结果
- [2024-11-05 22:00:41]
- 管理员手动重测本题所有提交记录
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2024-07-15 20:57:18]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2024-07-15 20:57:11]
- 提交
answer
#pragma once
#pragma GCC optimize("Ofast, unroll-loops")
#include "inv.h"
unsigned a[3035136], g[974849];
unsigned inv(int x) {
const unsigned 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;
}
unsigned getinv(unsigned x) {
return x == 1 ? 1 : 974849 - (unsigned long long)(974849 / x) * getinv(974849 % x) % 974849;
}
void init(int) {
for(unsigned i = 987;i;--i) {
unsigned inv = getinv(i);
for(unsigned 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(unsigned i = 2;i ^ 3035136;++i)
a[i] = 998244353 - (unsigned long long)(998244353 / i) * a[998244353 % i] % 998244353;
}
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: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:5:19: warning: bad option ‘-f unroll-loops’ to attribute ‘optimize’ [-Wattributes] 5 | unsigned inv(int x) { | ^ answer.code:5:10: error: ambiguating new declaration of ‘unsigned int inv(int)’ 5 | unsigned inv(int x) { | ^~~ inv.h:2:5: note: old declaration ‘int inv(int)’ 2 | int inv(int n); | ^~~ answer.code:9:27: warning: bad option ‘-f unroll-loops’ to attribute ‘optimize’ [-Wattributes] 9 | unsigned getinv(unsigned x) { | ^ answer.code:12:14: warning: bad option ‘-f unroll-loops’ to attribute ‘optimize’ [-Wattributes] 12 | void init(int) { | ^