QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#564107#1807. Distribute the Barsship2077WA 0ms3832kbC++23675b2024-09-14 20:10:102024-09-14 20:10:10

Judging History

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

  • [2024-09-14 20:10:10]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3832kb
  • [2024-09-14 20:10:10]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
vector<int>ans[5];int n,num;
void solve(int p){
	for (int i=p;i<=n;i+=4)
		ans[0].emplace_back(i*2-1),ans[0].emplace_back((i+3)*2-1),
		ans[1].emplace_back((i+1)*2-1),ans[1].emplace_back((i+2)*2-1);
}
void solve1(){ num=2; solve(1); }
void solve2(){ num=2; ans[0]={1,3,5,9}; ans[1]={7,11}; solve(7); }
int main(){
	scanf("%d",&n);
	if (n<=3||n&1) return puts("-1"),0;
	if (n%4==0) solve1();
	if (n%4==2) solve2();
	printf("%d\n",num);
	for (int i=0;i<num;i++){
		printf("%d ",(int)ans[i].size());
		for (int j=0;j<ans[i].size();j++)
			printf("%d%c",ans[i][j]," \n"[j==(int)ans[i].size()-1]);
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3808kb

input:

4

output:

2
2 1 7
2 3 5

result:

ok OK (2 groups)

Test #2:

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

input:

2

output:

-1

result:

ok OK (impossible)

Test #3:

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

input:

3

output:

-1

result:

ok OK (impossible)

Test #4:

score: -100
Wrong Answer
time: 0ms
memory: 3832kb

input:

1659

output:

-1

result:

wrong answer Jury found the solution, contestant isn't