QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#241457 | #5. 在线 O(1) 逆元 | mfeitveer | Compile Error | / | / | C++14 | 751b | 2023-11-06 07:58:32 | 2024-11-05 21:54:25 |
Judging History
你现在查看的是最新测评结果
- [2024-11-05 21:54:25]
- 管理员手动重测本题所有提交记录
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2023-11-06 07:58:32]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2023-11-06 07:58:32]
- 提交
answer
#include "inv.h"
const int M = 133834517;
const int mod = 998244353;
typedef long long ll;
struct HashMap
{
int ct, a[M], v[M], nxt[M], head[M];
inline int &operator[](const int &tmp) const
{
int x = 19260817ll * tmp % mod;
for(int i = head[x];i;i = nxt[i])
if(a[i] == tmp) return v[i];
nxt[++ct] = head[x], head[x] = ct;
a[ct] = tmp; return v[ct];
}
inline bool find(int tmp)
{
int x = 19260817ll * tmp % mod;
for(int i = head[x];i;i = nxt[i])
if(a[i] == tmp) return 1;
return 0;
}
} mp;
ll Inv[N];
ll ask(ll x)
{
if(mp.find(x)) return mp[x];
return mp[x] = (mod - mod / x) * ask(mod % x) % mod;
}
void init(int p)
{
mp[1] = 1;
}
int inv(int x)
{
return ask(x);
}
详细
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: In member function ‘int& HashMap::operator[](const int&) const’: answer.code:15:51: error: binding reference of type ‘int&’ to ‘const int’ discards qualifiers 15 | if(a[i] == tmp) return v[i]; | ~~~^ answer.code:16:23: error: increment of member ‘HashMap::ct’ in read-only object 16 | nxt[++ct] = head[x], head[x] = ct; | ^~ answer.code:16:27: error: assignment of read-only location ‘((const HashMap*)this)->HashMap::nxt[((int)(++((const HashMap*)this)->HashMap::ct))]’ 16 | nxt[++ct] = head[x], head[x] = ct; | ~~~~~~~~~~^~~~~~~~~ answer.code:16:46: error: assignment of read-only location ‘((const HashMap*)this)->HashMap::head[x]’ 16 | nxt[++ct] = head[x], head[x] = ct; | ~~~~~~~~^~~~ answer.code:17:23: error: assignment of read-only location ‘((const HashMap*)this)->HashMap::a[((int)((const HashMap*)this)->HashMap::ct)]’ 17 | a[ct] = tmp; return v[ct]; | ~~~~~~^~~~~ answer.code:17:41: error: binding reference of type ‘int&’ to ‘const int’ discards qualifiers 17 | a[ct] = tmp; return v[ct]; | ~~~~^ answer.code: At global scope: answer.code:28:8: error: ‘N’ was not declared in this scope 28 | ll Inv[N]; | ^