QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#67268#5099. 朝圣道NATURAL60 685ms7368kbC++141.0kb2022-12-10 11:18:382022-12-10 11:18:41

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:18:41]
  • 评测
  • 测评结果:0
  • 用时:685ms
  • 内存:7368kb
  • [2022-12-10 11:18:38]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
int op,mod,Phi;
inline long long qread()
{
	long long a=0,f=1;char ch=getchar();
	while(ch>'9'||ch<'0'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){a=(a*10)+(ch^48);ch=getchar();}
	return a*f;
}
inline long long qpow(register long long x,register int y)
{
	long long cx=1;
	while(y)
	{
		if(y&1)(cx*=x)%=mod;
		(x*=x)%=mod;
		y>>=1;
	}
	return cx;
}
inline long long C(register int x,register int y)
{
	if(x<y)return 0;
	if(y>x-y)y=x-y;
	long long a=1,b=1;
	for(register int i=0;i<y;++i)
	{
		(a*=(x-i))%=mod;
		(b*=(i+1))%=mod;
	}
	return a*qpow(b,mod-2)%mod;
}
long long lucas(register int x,register int y)
{
	if(y==0)return 1;
	return lucas(x/mod,y/mod)*C(x%mod,y%mod)%mod;
}
void init(int o, int p)
{
	op=o;mod=p;
	Phi=p;
	for(int i=2;i*i<=p;++i)
	{
		if(p%i==0)
		{
			Phi/=i;
			Phi*=(i-1);
		}
	}
	return ;
}
int ask(long long n)
{
	long long ans=n%mod*lucas(2*n-1,n-1)%mod;
	ans*=qpow(qpow(2,2*n-1),Phi-1);
	return ans%mod;
}

详细

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 685ms
memory: 7368kb

input:

1 910276 554767
6
10
7
4
10
12
9
3
3
5
7
10
5
6
1
6
3
9
6
8
12
11
8
2
12
5
9
3
8
2
12
11
2
3
4
9
2
5
5
11
6
4
8
11
3
9
2
2
8
9
2
8
9
6
2
9
2
10
10
7
5
6
4
4
11
12
8
8
2
2
4
3
3
5
6
6
8
11
6
9
9
3
4
1
2
2
6
9
9
2
3
2
12
6
1
7
2
4
12
11
4
7
6
3
9
4
6
5
3
3
12
6
2
1
1
7
2
6
5
9
11
6
3
4
11
1
2
4
5
4
10...

output:

2772
369013
12012
140
369013
136693
218790
30
30
630
12012
369013
630
2772
1
2772
30
218790
2772
51480
136693
551274
51480
6
136693
630
218790
30
51480
6
136693
551274
6
30
140
218790
6
630
630
551274
2772
140
51480
551274
30
218790
6
6
51480
218790
6
51480
218790
2772
6
218790
6
369013
369013
12012...

result:

wrong answer 1st numbers differ - expected: '5419', found: '2772'

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Wrong Answer

Test #5:

score: 0
Wrong Answer
time: 2ms
memory: 3236kb

input:

3 1 334547
8234

output:

323593

result:

wrong answer 1st numbers differ - expected: '179079', found: '323593'

Subtask #4:

score: 0
Skipped

Dependency #3:

0%

Subtask #5:

score: 0
Skipped

Dependency #4:

0%

Subtask #6:

score: 0
Time Limit Exceeded

Test #8:

score: 0
Time Limit Exceeded

input:

6 958477 522361
280121915553826833
734266539148641647
72849162479700582
274266741463686096
60278972064195458
828423669427600612
571432949203039978
518511460268700898
486268614705621285
19216283231217074
611458416727512530
175147354285288662
799769622289998997
400123443628688299
145546980862133838
40...

output:

Unauthorized output

result:


Subtask #7:

score: 0
Skipped

Dependency #3:

0%

Subtask #8:

score: 0
Time Limit Exceeded

Test #33:

score: 0
Time Limit Exceeded

input:

8 9963 251
831797004675585320
494759973681332858
701341496127272302
252910460485222469
250965009655458584
366193481309061299
633134388675839346
791999098066205672
196620805863610860
363773642045280947
466508590762410710
407790578717064135
181590911404670570
570642047249889864
70138464625729452
23634...

output:

Unauthorized output

result:


Subtask #9:

score: 0
Skipped

Dependency #2:

0%