QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#358063#6824. Demonstrational Sequencescrsfaa#WA 0ms3476kbC++14801b2024-03-19 16:55:072024-03-19 16:55:08

Judging History

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

  • [2024-03-19 16:55:08]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3476kb
  • [2024-03-19 16:55:07]
  • 提交

answer

#include<bits/stdc++.h>
#define Yukinoshita namespace
#define Yukino std
using Yukinoshita Yukino;
int read()
{
	int s=0,w=1;
	char ch=getchar();
	while(ch<'0'||ch>'9') w=ch=='-'?-1:1,ch=getchar();
	while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();
	return s*w;
}
/*
998244352 1048576 3
*/
int main()
{
	int p=read(),q=read(),k=read(),i;
	while(k--)
	{
		int a=read(),b=read();
		if(p==q)
		{
			putchar('1');
			continue;
		}
		set<int> st{a};
		for(;;)
		{
			a=(1ll*a*a+b)%p;
			if(st.size()>1000)
			{
				putchar('1');
				break;
			}
			if(st.count(a))
			{
				putchar('0');
				break;
			}
			for(auto x:st)
				if(__gcd((a-x+p)%p,p)==q)
				{
					putchar('1');
					break;
				}
//			cout<<a<<',';
			st.insert(a);
		}
//		puts("");	
	}
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3476kb

input:

15 5 5
1 1
1 2
2 4
4 8
8 16

output:

101001100

result:

wrong answer 1st words differ - expected: '11010', found: '101001100'