QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#803973 | #9852. Divisions | Wzy | WA | 0ms | 3724kb | C++14 | 2.1kb | 2024-12-07 19:41:51 | 2024-12-07 19:41:53 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL,LL> PII;
const int N=20,M=2*N;
const int mod=998244353;
const int INF=1e9+7;
/*void solve(){
int mid ;
cin >> mid ;
if(mid > 366){
cout << "-1" ;
return ;
}else if(mid == 0){
cout << "7\n" ;
cout << "2 5 3 6 4 3 5" ;
return ;
}else if(mid == 1){
cout << "6\n1 1 4 5 1 4" ;
return ;
}else{
cout << mid - 1 << '\n' ;
for(int i = 1 ; i <= mid - 1 ; ++ i) {
cout << i << ' ' ;
}
return ;
}
}*/
void solve(){
int n;
cin>>n;
if(!n){
cout << "7\n" ;
cout << "2 5 3 6 4 3 5" ;
return ;
}
if(n==1){
cout << "6\n1 1 4 5 1 4" ;
return ;
}
if(n<=366){
cout << n - 1 << '\n' ;
for(int i = 1 ; i <= n - 1 ; ++ i) {
cout << i << ' ' ;
}
return ;
}
int cnt=0;
n++;
for(int i=0;i<32;i++) if(((n)>>i)&1) cnt++;
if(cnt>2){
cout<<-1<<endl;
return ;
}
if(cnt==1){
int num;
for(int i=0;i<32;i++){
int t=(n>>i)&1;
if(!t) continue;
num=i;
}
cout<<2*num-2<<endl;
for(int i=0;i<num-1;i++) cout<<2<<" ";
for(int i=0;i<num-1;i++) cout<<1<<" ";
cout<<endl;
}
/*if(cnt==1){
int num;
for(int i=0;i<32;i++) if((n>>i)&1) num=i;
cout<<num<<endl;
for(int i=0;i<num;i++) cout<<1<<" ";
cout<<endl;
return ;
}*/
else {
int n1=-1,n2=-1;
for(int i=0;i<32;i++){
int t=(n>>i)&1;
if(!t) continue;
if(n1==-1) n1=i;
else n2=i;
}
//cout<<n1<<" "<<n2<<endl;
cout<<n1+n2<<endl;
for(int i=0;i<n1;i++) cout<<2<<" ";
for(int i=0;i<n2;i++) cout<<1<<" ";
}
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int T=1;
//cin>>T;
while(T--) solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3720kb
input:
1
output:
6 1 1 4 5 1 4
result:
ok correct
Test #2:
score: 0
Accepted
time: 0ms
memory: 3660kb
input:
2
output:
1 1
result:
ok correct
Test #3:
score: 0
Accepted
time: 0ms
memory: 3664kb
input:
0
output:
7 2 5 3 6 4 3 5
result:
ok correct
Test #4:
score: 0
Accepted
time: 0ms
memory: 3668kb
input:
3
output:
2 1 2
result:
ok correct
Test #5:
score: 0
Accepted
time: 0ms
memory: 3676kb
input:
4
output:
3 1 2 3
result:
ok correct
Test #6:
score: 0
Accepted
time: 0ms
memory: 3604kb
input:
5
output:
4 1 2 3 4
result:
ok correct
Test #7:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
6
output:
5 1 2 3 4 5
result:
ok correct
Test #8:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
7
output:
6 1 2 3 4 5 6
result:
ok correct
Test #9:
score: 0
Accepted
time: 0ms
memory: 3648kb
input:
8
output:
7 1 2 3 4 5 6 7
result:
ok correct
Test #10:
score: 0
Accepted
time: 0ms
memory: 3660kb
input:
9
output:
8 1 2 3 4 5 6 7 8
result:
ok correct
Test #11:
score: 0
Accepted
time: 0ms
memory: 3724kb
input:
10
output:
9 1 2 3 4 5 6 7 8 9
result:
ok correct
Test #12:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
11
output:
10 1 2 3 4 5 6 7 8 9 10
result:
ok correct
Test #13:
score: 0
Accepted
time: 0ms
memory: 3724kb
input:
12
output:
11 1 2 3 4 5 6 7 8 9 10 11
result:
ok correct
Test #14:
score: 0
Accepted
time: 0ms
memory: 3684kb
input:
13
output:
12 1 2 3 4 5 6 7 8 9 10 11 12
result:
ok correct
Test #15:
score: 0
Accepted
time: 0ms
memory: 3604kb
input:
14
output:
13 1 2 3 4 5 6 7 8 9 10 11 12 13
result:
ok correct
Test #16:
score: 0
Accepted
time: 0ms
memory: 3656kb
input:
15
output:
14 1 2 3 4 5 6 7 8 9 10 11 12 13 14
result:
ok correct
Test #17:
score: 0
Accepted
time: 0ms
memory: 3720kb
input:
16
output:
15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
result:
ok correct
Test #18:
score: 0
Accepted
time: 0ms
memory: 3648kb
input:
24
output:
23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
result:
ok correct
Test #19:
score: 0
Accepted
time: 0ms
memory: 3672kb
input:
31
output:
30 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
result:
ok correct
Test #20:
score: 0
Accepted
time: 0ms
memory: 3668kb
input:
32
output:
31 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
result:
ok correct
Test #21:
score: 0
Accepted
time: 0ms
memory: 3680kb
input:
63
output:
62 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
result:
ok correct
Test #22:
score: 0
Accepted
time: 0ms
memory: 3604kb
input:
64
output:
63 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
result:
ok correct
Test #23:
score: 0
Accepted
time: 0ms
memory: 3668kb
input:
127
output:
126 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 ...
result:
ok correct
Test #24:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
128
output:
127 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 ...
result:
ok correct
Test #25:
score: 0
Accepted
time: 0ms
memory: 3720kb
input:
255
output:
254 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 ...
result:
ok correct
Test #26:
score: 0
Accepted
time: 0ms
memory: 3668kb
input:
256
output:
255 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 ...
result:
ok correct
Test #27:
score: 0
Accepted
time: 0ms
memory: 3604kb
input:
511
output:
16 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1
result:
ok correct
Test #28:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
512
output:
9 1 1 1 1 1 1 1 1 1
result:
ok correct
Test #29:
score: 0
Accepted
time: 0ms
memory: 3720kb
input:
1023
output:
18 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1
result:
ok correct
Test #30:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
1024
output:
10 1 1 1 1 1 1 1 1 1 1
result:
ok correct
Test #31:
score: 0
Accepted
time: 0ms
memory: 3724kb
input:
16383
output:
26 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1
result:
ok correct
Test #32:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
16384
output:
14 1 1 1 1 1 1 1 1 1 1 1 1 1 1
result:
ok correct
Test #33:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
65535
output:
30 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
result:
ok correct
Test #34:
score: 0
Accepted
time: 0ms
memory: 3664kb
input:
65536
output:
16 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
result:
ok correct
Test #35:
score: 0
Accepted
time: 0ms
memory: 3668kb
input:
1048575
output:
38 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
result:
ok correct
Test #36:
score: 0
Accepted
time: 0ms
memory: 3652kb
input:
1048576
output:
20 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
result:
ok correct
Test #37:
score: 0
Accepted
time: 0ms
memory: 3636kb
input:
8388607
output:
44 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
result:
ok correct
Test #38:
score: 0
Accepted
time: 0ms
memory: 3608kb
input:
8388608
output:
23 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
result:
ok correct
Test #39:
score: -100
Wrong Answer
time: 0ms
memory: 3604kb
input:
16777200
output:
-1
result:
wrong answer jury has answer but participant not