QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#803825 | #9852. Divisions | Wzy# | WA | 0ms | 3728kb | C++14 | 1.5kb | 2024-12-07 18:53:34 | 2024-12-07 18:53:34 |
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 ;
}
if((n!=(n&-n))&&n!=((n-1)&-(n-1))+1){
cout<<-1<<endl;
return ;
}
int num;
for(int k=1;k<32;k++){
if((n>>k)&1){
num=k;
break;
}
}
if(n==((n-1)&-(n-1))+1){
cout<<num+1<<endl;
cout<<2<<" ";
}
else cout<<num<<endl;
for(int i=0;i<num;i++) cout<<1<<" ";
cout<<endl;
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int T=1;
//cin>>T;
while(T--) solve();
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3672kb
input:
1
output:
6 1 1 4 5 1 4
result:
ok correct
Test #2:
score: 0
Accepted
time: 0ms
memory: 3668kb
input:
2
output:
1 1
result:
ok correct
Test #3:
score: 0
Accepted
time: 0ms
memory: 3724kb
input:
0
output:
7 2 5 3 6 4 3 5
result:
ok correct
Test #4:
score: 0
Accepted
time: 0ms
memory: 3608kb
input:
3
output:
2 1 2
result:
ok correct
Test #5:
score: 0
Accepted
time: 0ms
memory: 3624kb
input:
4
output:
3 1 2 3
result:
ok correct
Test #6:
score: 0
Accepted
time: 0ms
memory: 3720kb
input:
5
output:
4 1 2 3 4
result:
ok correct
Test #7:
score: 0
Accepted
time: 0ms
memory: 3672kb
input:
6
output:
5 1 2 3 4 5
result:
ok correct
Test #8:
score: 0
Accepted
time: 0ms
memory: 3680kb
input:
7
output:
6 1 2 3 4 5 6
result:
ok correct
Test #9:
score: 0
Accepted
time: 0ms
memory: 3604kb
input:
8
output:
7 1 2 3 4 5 6 7
result:
ok correct
Test #10:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
9
output:
8 1 2 3 4 5 6 7 8
result:
ok correct
Test #11:
score: 0
Accepted
time: 0ms
memory: 3640kb
input:
10
output:
9 1 2 3 4 5 6 7 8 9
result:
ok correct
Test #12:
score: 0
Accepted
time: 0ms
memory: 3672kb
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: 3728kb
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: 3604kb
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: 3600kb
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: 3608kb
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: 3660kb
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: 3608kb
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: 3668kb
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: 3680kb
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: 3724kb
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: 3656kb
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: 3728kb
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: 3672kb
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: -100
Wrong Answer
time: 0ms
memory: 3608kb
input:
511
output:
-1
result:
wrong answer jury has answer but participant not