QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#370714 | #1807. Distribute the Bars | crsfaa | WA | 2ms | 6564kb | C++14 | 805b | 2024-03-29 15:37:48 | 2024-03-29 15:37:49 |
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;
}
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("");
}
}
详细
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