QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#606188#5. 在线 O(1) 逆元Yoshinow2001Compile Error//C++23599b2024-10-02 22:59:412024-10-02 22:59:41

Judging History

你现在查看的是测评时间为 2024-10-02 22:59:41 的历史记录

  • [2024-11-05 22:04:21]
  • 管理员手动重测本题所有提交记录
  • [2024-10-02 22:59:41]
  • 评测
  • [2024-10-02 22:59:41]
  • 提交

answer

#include<bits/stdc++.h>
#include "inv.h"
const int N=(1<<21)+5;
const int mod=998244353;
const int B=1024;
int pl[N],iv[N];
void init(int p){
	const int n=2*B*B;
	iv[1]=1;
	for(int i=2;i<=n;i++) iv[i]=1ll*(mod-iv[mod%i])*(mod/i)%mod;
	for(int i=1;i<=B;i++){
		int x=0;
		while(x<=B*B){
			ll w=1ll*x*B*i%mod;
			if(w<=B*B||w>=mod-B*B) pl[x]=i,x++;
			else{
				x+=(mod-B*B-w+B*i-1)/(B*i);
			}
		}
	}
	// gdb(pl[100000]*100000ll*B%mod);
}
int inv(int x){
	ll w=1ll*x*pl[x>>10]%mod;
	if(w<=2*B*B) return 1ll*iv[w]*pl[x/B]%mod;
	else return 1ll*(mod-iv[mod-w])*pl[x/B]%mod;
}

详细

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 function ‘void init(int)’:
answer.code:14:25: error: ‘ll’ was not declared in this scope; did you mean ‘pl’?
   14 |                         ll w=1ll*x*B*i%mod;
      |                         ^~
      |                         pl
answer.code:15:28: error: ‘w’ was not declared in this scope
   15 |                         if(w<=B*B||w>=mod-B*B) pl[x]=i,x++;
      |                            ^
answer.code: In function ‘int inv(int)’:
answer.code:24:9: error: ‘ll’ was not declared in this scope; did you mean ‘pl’?
   24 |         ll w=1ll*x*pl[x>>10]%mod;
      |         ^~
      |         pl
answer.code:25:12: error: ‘w’ was not declared in this scope
   25 |         if(w<=2*B*B) return 1ll*iv[w]*pl[x/B]%mod;
      |            ^