QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#24262 | #1807. Distribute the Bars | Wu_Ren | WA | 2ms | 3732kb | C++17 | 503b | 2022-03-28 21:35:04 | 2022-04-30 05:22:05 |
Judging History
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 "<<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: 100
Accepted
time: 2ms
memory: 3528kb
input:
4
output:
2 2 1 7 2 3 5
result:
ok OK (2 groups)
Test #2:
score: 0
Accepted
time: 2ms
memory: 3464kb
input:
2
output:
-1
result:
ok OK (impossible)
Test #3:
score: 0
Accepted
time: 1ms
memory: 3732kb
input:
3
output:
-1
result:
ok OK (impossible)
Test #4:
score: -100
Wrong Answer
time: 1ms
memory: 3468kb
input:
1659
output:
3 553 1 9 17 3317 19 3315 21 3313 23 3311 25 3309 27 3307 29 3305 31 3303 33 3301 35 3299 37 3297 39 3295 41 3293 43 3291 45 3289 47 3287 49 3285 51 3283 53 3281 55 3279 57 3277 59 3275 61 3273 63 3271 65 3269 67 3267 69 3265 71 3263 73 3261 75 3259 77 3257 79 3255 81 3253 83 3251 85 3249 87 3247 89...
result:
wrong answer Integer 2767 violates the range [1, 1659]