QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#432053#1807. Distribute the Barsgrass8cow#WA 1ms3940kbC++17611b2024-06-06 17:10:402024-06-06 17:10:41

Judging History

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

  • [2024-06-06 17:10:41]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3940kb
  • [2024-06-06 17:10:40]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int n;
int main(){
    scanf("%d",&n);
    int z=0;
    for(int i=2;i<n;i++)if(!(n%i)){z=i;break;}
    if(!z){puts("-1");return 0;}
    if(z==2){
        int l=1,r=n*2-1;
        for(int i=1;i<=n/2;i++)
        printf("%d %d\n",l,r),l+=2,r-=2;
        return 0;
    }
    printf("%d\n",z);
    int l=z*z*2+1,r=n*2-1;
    for(int i=0;i<z;i++){
        printf("%d ",n/z);
        for(int j=0;j<z;j++)
        printf("%d ",(j*z+(j+i)%z)*2+1);
        for(int j=z;j<n/z;j+=2)printf("%d %d ",l,r),l+=2,r-=2;
        puts("");
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3940kb

input:

4

output:

1 7
3 5

result:

wrong answer M=1 is too small