QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#24261#1807. Distribute the BarsWu_RenWA 3ms3676kbC++17497b2022-03-28 21:34:232022-04-30 05:22:02

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-04-30 05:22:02]
  • 评测
  • 测评结果:WA
  • 用时:3ms
  • 内存:3676kb
  • [2022-03-28 21:34:23]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
int n,d,m;
int main(){
	ios::sync_with_stdio(0);
	cin>>n;
	for(d=2;n%d;d++);
	if(d==n) cout<<"-1\n",exit(0);
	m=n/d;
	if(d==2){
		cout<<m<<"\n";
		for(int i=0;i<m;i++) cout<<2*i+1<<" "<<2*n-2*i-1<<"\n";
	}
	else{
		cout<<d<<"\n";
		int c=0;
		for(int i=0;i<d;i++){
			cout<<m<<" ";
			for(int j=0;j<d;j++) cout<<2*((i+j)%d+d*j)+1<<" ";
			for(int j=d;j<m;j++) cout<<2*n-2*c-1<<" "<<2*d*d+1+2*c<<" ",c++;
			cout<<"\n";
		} 
	}
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 3ms
memory: 3676kb

input:

4

output:

2
1 7
3 5

result:

wrong output format Unexpected end of file - int32 expected