QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#564107 | #1807. Distribute the Bars | ship2077 | WA | 0ms | 3832kb | C++23 | 675b | 2024-09-14 20:10:10 | 2024-09-14 20:10:10 |
Judging History
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