QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#370714#1807. Distribute the BarscrsfaaWA 2ms6564kbC++14805b2024-03-29 15:37:482024-03-29 15:37:49

Judging History

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

  • [2024-03-29 15:37:49]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:6564kb
  • [2024-03-29 15:37:48]
  • 提交

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;
}
const int mxn=1e5+5;
vector<int> res[mxn];
using ll=long long;
ll sum[mxn];
int main()
{
	int n=read(),i,j,p;
	if(n==2) return cout<<-1,0;
	if(n%2==0)
	{
		cout<<n/2<<endl;
		for(i=1,j=n*2-1;i<=j;i+=2,j-=2)
			cout<<2<<' '<<i<<' '<<j<<endl;
		return 0;
	}
	bool fl=0;
	for(p=2;p*p<=n;p++)
		if(n%(p*p)==0)
		{
			fl=1;
			break;
		} 
	if(!fl) return cout<<-1,0;
	printf("%d\n",n/p);
	for(i=1;i<=n;i+=p)
	{
		printf("%d ",p);
		for(j=0;j<p;j++)
			printf("%d ",((j+i/p)%p+i)*2-1);
		puts("");
	}
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 5888kb

input:

4

output:

2
2 1 7
2 3 5

result:

ok OK (2 groups)

Test #2:

score: 0
Accepted
time: 0ms
memory: 6564kb

input:

2

output:

-1

result:

ok OK (impossible)

Test #3:

score: 0
Accepted
time: 1ms
memory: 6112kb

input:

3

output:

-1

result:

ok OK (impossible)

Test #4:

score: -100
Wrong Answer
time: 1ms
memory: 5984kb

input:

1659

output:

-1

result:

wrong answer Jury found the solution, contestant isn't