QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#564518#5. 在线 O(1) 逆元caowenzeCompile Error//C++17837b2024-09-15 08:47:202024-11-05 22:03:41

Judging History

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

  • [2024-11-05 22:03:41]
  • 管理员手动重测本题所有提交记录
  • [2024-09-15 08:47:20]
  • 评测
  • [2024-09-15 08:47:20]
  • 提交

answer

#include<bits/stdc++.h>
#include"inv.h"
#define ll long long
using namespace std;
const int N=(1<<21)+1,mod=998244353,M=1024;
int k,p[N<<1],*iv=pool+N;
struct I{
	int ml,dis;
}mp[N];
int inv(int w){
	I d=mp[w>>10];
	return (ll)iv[w*d.ml-d.dis]*(mod+d.ml)%mod;
}
void init(int rp){
	k=mod/M;
	int rlim=mod-k;
	for(int i=1;i<=M;i++){
		int cut=0,add=i*M;
		for(int p=0;p<=k;){
			if(cur<=k)mp[p].ml=i;
			else if(cur>rlim)mp[p].ml=-i;
			else{
				int x=(rlim-cur)/add;
				cut+=a*add,p+=a;
			}
			cut+=add,p++;
			if(cur>=mod)cur-=mod;
		}
	}
	int count=0;
	for(int i=1;i<=k;i++)
		if(mp[i].ml>0)mp[i].dis=(ll)mp[i].ml*i*M/mod*mod,++count;
		else mp[i].dis=(ll)mp[i].ml*i*M/mod*mod-mod,++count;
	iv[1]=1;
	for(int i=2;i<=N-1)iv[i]=(ll)iv[mod%i]*(mod-mod/i)%mod;
	for(int i=1;i<=N-1)iv[-i]=mod-iv[i];
}

詳細信息

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:6:19: error: ‘pool’ was not declared in this scope; did you mean ‘powl’?
    6 | int k,p[N<<1],*iv=pool+N;
      |                   ^~~~
      |                   powl
answer.code: In function ‘void init(int)’:
answer.code:20:28: error: ‘cur’ was not declared in this scope; did you mean ‘cut’?
   20 |                         if(cur<=k)mp[p].ml=i;
      |                            ^~~
      |                            cut
answer.code:24:38: error: ‘a’ was not declared in this scope
   24 |                                 cut+=a*add,p+=a;
      |                                      ^
answer.code:27:28: error: ‘cur’ was not declared in this scope; did you mean ‘cut’?
   27 |                         if(cur>=mod)cur-=mod;
      |                            ^~~
      |                            cut
answer.code:35:27: error: expected ‘;’ before ‘)’ token
   35 |         for(int i=2;i<=N-1)iv[i]=(ll)iv[mod%i]*(mod-mod/i)%mod;
      |                           ^
      |                           ;
answer.code:36:27: error: expected ‘;’ before ‘)’ token
   36 |         for(int i=1;i<=N-1)iv[-i]=mod-iv[i];
      |                           ^
      |                           ;