QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#67309 | #5099. 朝圣道 | _ZMF_ | Compile Error | / | / | C++11 | 2.0kb | 2022-12-10 11:41:06 | 2022-12-10 11:41:12 |
Judging History
你现在查看的是最新测评结果
- [2023-08-10 23:21:45]
- System Update: QOJ starts to keep a history of the judgings of all the submissions.
- [2022-12-10 11:41:12]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2022-12-10 11:41:06]
- 提交
answer
#include<bits/stdc++.h>
#include "pilgrimage.h"
using namespace std;
#define int long long
typedef long long ll;
ll exgcd(ll a,ll b,ll &x,ll &y)
{
if(!b){x=1;y=0;return a;}
ll res=exgcd(b,a%b,x,y),t;
t=x;x=y;y=t-a/b*y;
return res;
}
const int N = 1e6 + 9;
ll p;
vector<int> G;
vector<int> jc[N];
inline ll power(ll a,ll b,ll mod)
{
ll sm;
for(sm=1;b;b>>=1,a=a*a%mod)if(b&1)
sm=sm*a%mod;
return sm;
}
ll fac(ll n,ll pi,ll pk)
{
if(!n)return 1;
ll res=1;
res = res * jc[pi][pk] % pk;
res=power(res,n/pk,pk);
res = res * jc[pi][n % pk] % pk;
return res*fac(n/pi,pi,pk)%pk;
}
inline ll inv(ll n,ll mod)
{
ll x,y;
exgcd(n,mod,x,y);
return (x+=mod)>mod?x-mod:x;
}
inline ll CRT(ll b,ll mod){return b*inv(p/mod,mod)%p*(p/mod)%p;}
const int MAXN=11;
static ll n,m;
static ll w[MAXN];
inline ll C(ll n,ll m,ll pi,ll pk)
{
ll up=fac(n,pi,pk),d1=fac(m,pi,pk),d2=fac(n-m,pi,pk);
ll k=0;
for(register ll i=n;i;i/=pi)k+=i/pi;
for(register ll i=m;i;i/=pi)k-=i/pi;
for(register ll i=n-m;i;i/=pi)k-=i/pi;
return up*inv(d1,pk)%pk*inv(d2,pk)%pk*power(pi,k,pk)%pk;
}
inline ll exlucus(ll n,ll m)
{
ll res=0,pk,tmp=p;
for(auto v : G)
{
int i = v;
pk=1;while(tmp%i==0)pk*=i,tmp/=i;
// cout << i << " " << pk << endl;
(res+=CRT(C(n,m,i,pk),pk))%=p;
}
if(tmp>1)(res+=CRT(C(n,m,tmp,tmp),tmp))%=p;
return res;
}
inline void init(int o, int p)
{
int tmp = p;
for (int i = 2; i <= tmp; i++)
if(tmp % i == 0)
{
G.push_back(i);
int pk = 1; while(tmp % i == 0) pk *= i, tmp /= i;
jc[i].push_back(1); jc[i].push_back(1); int now = 1;
for (int j = 2; j <= pk; j++)
{
if(j % i) now = now * j % pk;
jc[i].push_back(now);
}
}
}
inline int ask(int n)
{
int inv2 = (p + 1) / 2;
int ans = n % p; ans = ans * exlucus(n * 2, n) % p;
ans = ans * power(inv2, 2 * n, p) % p;
return ans;
}
詳細信息
answer.code:90:12: error: ambiguating new declaration of ‘long long int ask(long long int)’ 90 | inline int ask(int n) | ^~~ In file included from answer.code:2: pilgrimage.h:3:5: note: old declaration ‘int ask(long long int)’ 3 | int ask (long long n); | ^~~