QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#358063 | #6824. Demonstrational Sequences | crsfaa# | WA | 0ms | 3476kb | C++14 | 801b | 2024-03-19 16:55:07 | 2024-03-19 16:55:08 |
Judging History
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'