QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#21268#2820. 令人难以忘记的题目名称DaBenZhongXiaSongKuaiDi#Compile Error//C972b2022-03-04 14:18:382022-05-18 04:11:11

Judging History

This is the latest submission verdict.

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-05-18 04:11:11]
  • Judged
  • [2022-03-04 14:18:38]
  • Submitted

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;
}

詳細信息

answer.code:1:9: fatal error: iostream: No such file or directory
 #include<iostream>
         ^~~~~~~~~~
compilation terminated.