QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#606183#5. 在线 O(1) 逆元Yoshinow2001Compile Error//C++23549b2024-10-02 22:56:502024-11-05 22:04:17

Judging History

This is the latest submission verdict.

  • [2024-11-05 22:04:17]
  • 管理员手动重测本题所有提交记录
  • [2024-10-02 22:56:50]
  • Judged
  • [2024-10-02 22:56:50]
  • Submitted

answer

#include<bits/stdc++.h>
#include "inv.h"
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;
}

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:4:8: error: ‘N’ was not declared in this scope
    4 | int pl[N],iv[N];
      |        ^
answer.code:4:14: error: ‘N’ was not declared in this scope
    4 | int pl[N],iv[N];
      |              ^
answer.code: In function ‘void init(int)’:
answer.code:7:9: error: ‘iv’ was not declared in this scope; did you mean ‘inv’?
    7 |         iv[1]=1;
      |         ^~
      |         inv
answer.code:8:42: error: ‘mod’ was not declared in this scope; did you mean ‘modf’?
    8 |         for(int i=2;i<=n;i++) iv[i]=1ll*(mod-iv[mod%i])*(mod/i)%mod;
      |                                          ^~~
      |                                          modf
answer.code:12:25: error: ‘ll’ was not declared in this scope
   12 |                         ll w=1ll*x*B*i%mod;
      |                         ^~
answer.code:13:28: error: ‘w’ was not declared in this scope
   13 |                         if(w<=B*B||w>=mod-B*B) pl[x]=i,x++;
      |                            ^
answer.code:13:39: error: ‘mod’ was not declared in this scope; did you mean ‘modf’?
   13 |                         if(w<=B*B||w>=mod-B*B) pl[x]=i,x++;
      |                                       ^~~
      |                                       modf
answer.code:13:48: error: ‘pl’ was not declared in this scope; did you mean ‘p’?
   13 |                         if(w<=B*B||w>=mod-B*B) pl[x]=i,x++;
      |                                                ^~
      |                                                p
answer.code: In function ‘int inv(int)’:
answer.code:22:9: error: ‘ll’ was not declared in this scope
   22 |         ll w=1ll*x*pl[x>>10]%mod;
      |         ^~
answer.code:23:12: error: ‘w’ was not declared in this scope
   23 |         if(w<=2*B*B) return 1ll*iv[w]*pl[x/B]%mod;
      |            ^
answer.code:23:33: error: ‘iv’ was not declared in this scope; did you mean ‘inv’?
   23 |         if(w<=2*B*B) return 1ll*iv[w]*pl[x/B]%mod;
      |                                 ^~
      |                                 inv
answer.code:23:39: error: ‘pl’ was not declared in this scope
   23 |         if(w<=2*B*B) return 1ll*iv[w]*pl[x/B]%mod;
      |                                       ^~
answer.code:23:47: error: ‘mod’ was not declared in this scope; did you mean ‘modf’?
   23 |         if(w<=2*B*B) return 1ll*iv[w]*pl[x/B]%mod;
      |                                               ^~~
      |                                               modf
answer.code:24:26: error: ‘mod’ was not declared in this scope; did you mean ‘modf’?
   24 |         else return 1ll*(mod-iv[mod-w])*pl[x/B]%mod;
      |                          ^~~
      |                          modf
answer.code:24:30: error: ‘iv’ was not declared in this scope; did you mean ‘inv’?
   24 |         else return 1ll*(mod-iv[mod-w])*pl[x/B]%mod;
      |                              ^~
      |                              inv
answer.code:24:41: error: ‘pl’ was not declared in this scope
   24 |         else return 1ll*(mod-iv[mod-w])*pl[x/B]%mod;
      |                                         ^~