QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#32153 | #1807. Distribute the Bars | Appleblue17 | WA | 3ms | 3664kb | C++ | 440b | 2022-05-17 20:49:54 | 2022-05-17 20:49:55 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int n;
int main(){
cin>>n;
if(n%2==0 && n>2){
printf("%d\n",n/2);
for(int i=1;i<=n/2;i++) printf("2 %d %d\n",2*i-1,2*(n+1-i)-1);
return 0;
}
for(int i=2;i<n;i++){
if(i*i==n){
printf("%d\n",i);
for(int j=0;j<i;j++){
printf("%d ",i);
for(int t=0;t<i;t++){
printf("%d ",2*(t*i+(t+j)%i+1)-1);
}
printf("\n");
}
}
}
puts("-1");
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 3ms
memory: 3664kb
input:
4
output:
2 2 1 7 2 3 5
result:
ok OK (2 groups)
Test #2:
score: 0
Accepted
time: 3ms
memory: 3564kb
input:
2
output:
-1
result:
ok OK (impossible)
Test #3:
score: 0
Accepted
time: 3ms
memory: 3560kb
input:
3
output:
-1
result:
ok OK (impossible)
Test #4:
score: -100
Wrong Answer
time: 2ms
memory: 3448kb
input:
1659
output:
-1
result:
wrong answer Jury found the solution, contestant isn't