QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#21272 | #2820. 令人难以忘记的题目名称 | DaBenZhongXiaSongKuaiDi# | WA | 18ms | 4892kb | C++20 | 972b | 2022-03-04 14:20:01 | 2022-05-08 02:49:07 |
Judging History
answer
#include<iostream>
#include<cstdio>
using namespace std;
inline int read()
{
int n=0,f=1,ch=getchar();
while(ch<'0'||ch>'9')
{
if(ch=='-')f=-1;
ch=getchar();
}
while(ch>='0'&&ch<='9')
{
n=n*10+ch-'0';
ch=getchar();
}
return n*f;
}
int a[300005];
int main()
{
int n,p,ans;
bool flag;
n=read();
p=read();
for(int i=1;i<=n;i++)
{
a[i]=read();
a[i]%=p;
}
flag=true;
for(int i=1;i<=n;i++)if(a[i]!=0)flag=false;
if(flag==true)
{
printf("0\n");
return 0;
}
for(int i=1;i<=n;i++)if(a[i]!=a[1])flag=false;
if(flag==true)
{
printf("1\n");
return 0;
}
if(p!=2)
{
printf("-1\n");
return 0;
}
flag=true;
for(int i=1;i<=n;i++)
{
if(a[i]!=i%2)flag=false;
}
if(flag==true)
{
printf("2\n");
return 0;
}
flag=true;
for(int i=1;i<=n;i++)
{
if(a[i]!=(i+1)%2)flag=false;
}
if(flag==true)
{
printf("2\n");
return 0;
}
printf("-1\n");
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 18ms
memory: 4892kb
input:
297910 31 113232 54750 68197 111096 34111 93605 123591 18035 81089 116592 24694 31596 60286 93804 59021 38782 20907 112337 52523 99808 71474 60598 132242 65758 78755 58580 4515 138889 92332 154059 2039 74180 53778 93861 30218 87862 32418 153778 129564 113461 138995 154233 145061 44213 116624 72685 8...
output:
-1
result:
wrong answer 1st lines differ - expected: '29019', found: '-1'