QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#645141 | #8004. Bit Component | hezlik | AC ✓ | 6ms | 4776kb | C++20 | 1.1kb | 2024-10-16 17:03:21 | 2024-10-16 17:03:22 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
std::vector<int> Divide(int m){
if (!m) return {1};
auto a=Divide(m-1);
auto b=a;
std::reverse(a.begin(),a.end());
for (int x:a)
b.push_back(x|1<<m);
b.push_back(1<<m);
return b;
}
void solve(){
int n;
std::cin>>n;
int m=0;
for (int t=n;t;t>>=1) ++m;
std::vector<int> ans;
if (m<=3){
if (n!=(1<<m)-1){
std::cout<<"NO\n";
return;
}
ans=Divide(m-1);
}else{
if (n<=(1<<(m-1)|1<<(m-2))){
std::cout<<"NO\n";
return;
}
// std::cerr<<" m : "<<m<<'\n';
ans=Divide(m-2);
ans.pop_back();
// std::cerr<<" size : "<<ans.size()<<'\n';
auto t=Divide(m-3);
for (int x:t){
x|=1<<(m-1);
if ((x|1<<(m-2))<=n)
ans.push_back(x|1<<(m-2));
ans.push_back(x);
}
ans.push_back(1<<(m-1));
ans.push_back(1<<(m-1)|1<<(m-2));
ans.push_back(1<<(m-2));
}
std::cout<<"YES\n";
for (int x:ans)
std::cout<<x<<' ';
std::cout<<'\n';
}
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int T=1;
while(T--) solve();
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3508kb
input:
1
output:
YES 1
result:
ok answer is 1
Test #2:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
2
output:
NO
result:
ok answer is 0
Test #3:
score: 0
Accepted
time: 0ms
memory: 3628kb
input:
3
output:
YES 1 3 2
result:
ok answer is 1
Test #4:
score: 0
Accepted
time: 0ms
memory: 3560kb
input:
4
output:
NO
result:
ok answer is 0
Test #5:
score: 0
Accepted
time: 0ms
memory: 3564kb
input:
5
output:
NO
result:
ok answer is 0
Test #6:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
6
output:
NO
result:
ok answer is 0
Test #7:
score: 0
Accepted
time: 0ms
memory: 3564kb
input:
7
output:
YES 1 3 2 6 7 5 4
result:
ok answer is 1
Test #8:
score: 0
Accepted
time: 0ms
memory: 3564kb
input:
8
output:
NO
result:
ok answer is 0
Test #9:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
9
output:
NO
result:
ok answer is 0
Test #10:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
10
output:
NO
result:
ok answer is 0
Test #11:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
11
output:
NO
result:
ok answer is 0
Test #12:
score: 0
Accepted
time: 0ms
memory: 3632kb
input:
12
output:
NO
result:
ok answer is 0
Test #13:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
13
output:
YES 1 3 2 6 7 5 13 9 11 10 8 12 4
result:
ok answer is 1
Test #14:
score: 0
Accepted
time: 0ms
memory: 3824kb
input:
14
output:
YES 1 3 2 6 7 5 13 9 11 14 10 8 12 4
result:
ok answer is 1
Test #15:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
15
output:
YES 1 3 2 6 7 5 13 9 15 11 14 10 8 12 4
result:
ok answer is 1
Test #16:
score: 0
Accepted
time: 0ms
memory: 3628kb
input:
16
output:
NO
result:
ok answer is 0
Test #17:
score: 0
Accepted
time: 0ms
memory: 3656kb
input:
17
output:
NO
result:
ok answer is 0
Test #18:
score: 0
Accepted
time: 0ms
memory: 3832kb
input:
23
output:
NO
result:
ok answer is 0
Test #19:
score: 0
Accepted
time: 0ms
memory: 3564kb
input:
24
output:
NO
result:
ok answer is 0
Test #20:
score: 0
Accepted
time: 0ms
memory: 3828kb
input:
25
output:
YES 1 3 2 6 7 5 4 12 13 15 14 10 11 9 25 17 19 18 22 23 21 20 16 24 8
result:
ok answer is 1
Test #21:
score: 0
Accepted
time: 0ms
memory: 3792kb
input:
26
output:
YES 1 3 2 6 7 5 4 12 13 15 14 10 11 9 25 17 19 26 18 22 23 21 20 16 24 8
result:
ok answer is 1
Test #22:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
27
output:
YES 1 3 2 6 7 5 4 12 13 15 14 10 11 9 25 17 27 19 26 18 22 23 21 20 16 24 8
result:
ok answer is 1
Test #23:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
40
output:
NO
result:
ok answer is 0
Test #24:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
53
output:
YES 1 3 2 6 7 5 4 12 13 15 14 10 11 9 8 24 25 27 26 30 31 29 28 20 21 23 22 18 19 17 49 33 51 35 50 34 38 39 53 37 52 36 44 45 47 46 42 43 41 40 32 48 16
result:
ok answer is 1
Test #25:
score: 0
Accepted
time: 0ms
memory: 3624kb
input:
93
output:
NO
result:
ok answer is 0
Test #26:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
105
output:
YES 1 3 2 6 7 5 4 12 13 15 14 10 11 9 8 24 25 27 26 30 31 29 28 20 21 23 22 18 19 17 16 48 49 51 50 54 55 53 52 60 61 63 62 58 59 57 56 40 41 43 42 46 47 45 44 36 37 39 38 34 35 33 97 65 99 67 98 66 102 70 103 71 101 69 100 68 76 77 79 78 74 75 105 73 104 72 88 89 91 90 94 95 93 92 84 85 87 86 82 83...
result:
ok answer is 1
Test #27:
score: 0
Accepted
time: 0ms
memory: 3624kb
input:
132
output:
NO
result:
ok answer is 0
Test #28:
score: 0
Accepted
time: 0ms
memory: 3564kb
input:
221
output:
YES 1 3 2 6 7 5 4 12 13 15 14 10 11 9 8 24 25 27 26 30 31 29 28 20 21 23 22 18 19 17 16 48 49 51 50 54 55 53 52 60 61 63 62 58 59 57 56 40 41 43 42 46 47 45 44 36 37 39 38 34 35 33 32 96 97 99 98 102 103 101 100 108 109 111 110 106 107 105 104 120 121 123 122 126 127 125 124 116 117 119 118 114 115 ...
result:
ok answer is 1
Test #29:
score: 0
Accepted
time: 0ms
memory: 3852kb
input:
373
output:
NO
result:
ok answer is 0
Test #30:
score: 0
Accepted
time: 0ms
memory: 3508kb
input:
473
output:
YES 1 3 2 6 7 5 4 12 13 15 14 10 11 9 8 24 25 27 26 30 31 29 28 20 21 23 22 18 19 17 16 48 49 51 50 54 55 53 52 60 61 63 62 58 59 57 56 40 41 43 42 46 47 45 44 36 37 39 38 34 35 33 32 96 97 99 98 102 103 101 100 108 109 111 110 106 107 105 104 120 121 123 122 126 127 125 124 116 117 119 118 114 115 ...
result:
ok answer is 1
Test #31:
score: 0
Accepted
time: 0ms
memory: 3564kb
input:
513
output:
NO
result:
ok answer is 0
Test #32:
score: 0
Accepted
time: 0ms
memory: 3680kb
input:
934
output:
YES 1 3 2 6 7 5 4 12 13 15 14 10 11 9 8 24 25 27 26 30 31 29 28 20 21 23 22 18 19 17 16 48 49 51 50 54 55 53 52 60 61 63 62 58 59 57 56 40 41 43 42 46 47 45 44 36 37 39 38 34 35 33 32 96 97 99 98 102 103 101 100 108 109 111 110 106 107 105 104 120 121 123 122 126 127 125 124 116 117 119 118 114 115 ...
result:
ok answer is 1
Test #33:
score: 0
Accepted
time: 0ms
memory: 3572kb
input:
1356
output:
NO
result:
ok answer is 0
Test #34:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
1651
output:
YES 1 3 2 6 7 5 4 12 13 15 14 10 11 9 8 24 25 27 26 30 31 29 28 20 21 23 22 18 19 17 16 48 49 51 50 54 55 53 52 60 61 63 62 58 59 57 56 40 41 43 42 46 47 45 44 36 37 39 38 34 35 33 32 96 97 99 98 102 103 101 100 108 109 111 110 106 107 105 104 120 121 123 122 126 127 125 124 116 117 119 118 114 115 ...
result:
ok answer is 1
Test #35:
score: 0
Accepted
time: 0ms
memory: 3628kb
input:
2263
output:
NO
result:
ok answer is 0
Test #36:
score: 0
Accepted
time: 1ms
memory: 3788kb
input:
3330
output:
YES 1 3 2 6 7 5 4 12 13 15 14 10 11 9 8 24 25 27 26 30 31 29 28 20 21 23 22 18 19 17 16 48 49 51 50 54 55 53 52 60 61 63 62 58 59 57 56 40 41 43 42 46 47 45 44 36 37 39 38 34 35 33 32 96 97 99 98 102 103 101 100 108 109 111 110 106 107 105 104 120 121 123 122 126 127 125 124 116 117 119 118 114 115 ...
result:
ok answer is 1
Test #37:
score: 0
Accepted
time: 0ms
memory: 3792kb
input:
4375
output:
NO
result:
ok answer is 0
Test #38:
score: 0
Accepted
time: 0ms
memory: 3652kb
input:
7989
output:
YES 1 3 2 6 7 5 4 12 13 15 14 10 11 9 8 24 25 27 26 30 31 29 28 20 21 23 22 18 19 17 16 48 49 51 50 54 55 53 52 60 61 63 62 58 59 57 56 40 41 43 42 46 47 45 44 36 37 39 38 34 35 33 32 96 97 99 98 102 103 101 100 108 109 111 110 106 107 105 104 120 121 123 122 126 127 125 124 116 117 119 118 114 115 ...
result:
ok answer is 1
Test #39:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
10925
output:
NO
result:
ok answer is 0
Test #40:
score: 0
Accepted
time: 1ms
memory: 3636kb
input:
14097
output:
YES 1 3 2 6 7 5 4 12 13 15 14 10 11 9 8 24 25 27 26 30 31 29 28 20 21 23 22 18 19 17 16 48 49 51 50 54 55 53 52 60 61 63 62 58 59 57 56 40 41 43 42 46 47 45 44 36 37 39 38 34 35 33 32 96 97 99 98 102 103 101 100 108 109 111 110 106 107 105 104 120 121 123 122 126 127 125 124 116 117 119 118 114 115 ...
result:
ok answer is 1
Test #41:
score: 0
Accepted
time: 0ms
memory: 3796kb
input:
16893
output:
NO
result:
ok answer is 0
Test #42:
score: 0
Accepted
time: 2ms
memory: 3740kb
input:
28913
output:
YES 1 3 2 6 7 5 4 12 13 15 14 10 11 9 8 24 25 27 26 30 31 29 28 20 21 23 22 18 19 17 16 48 49 51 50 54 55 53 52 60 61 63 62 58 59 57 56 40 41 43 42 46 47 45 44 36 37 39 38 34 35 33 32 96 97 99 98 102 103 101 100 108 109 111 110 106 107 105 104 120 121 123 122 126 127 125 124 116 117 119 118 114 115 ...
result:
ok answer is 1
Test #43:
score: 0
Accepted
time: 0ms
memory: 3624kb
input:
40092
output:
NO
result:
ok answer is 0
Test #44:
score: 0
Accepted
time: 0ms
memory: 3668kb
input:
54980
output:
YES 1 3 2 6 7 5 4 12 13 15 14 10 11 9 8 24 25 27 26 30 31 29 28 20 21 23 22 18 19 17 16 48 49 51 50 54 55 53 52 60 61 63 62 58 59 57 56 40 41 43 42 46 47 45 44 36 37 39 38 34 35 33 32 96 97 99 98 102 103 101 100 108 109 111 110 106 107 105 104 120 121 123 122 126 127 125 124 116 117 119 118 114 115 ...
result:
ok answer is 1
Test #45:
score: 0
Accepted
time: 0ms
memory: 3660kb
input:
88104
output:
NO
result:
ok answer is 0
Test #46:
score: 0
Accepted
time: 5ms
memory: 3996kb
input:
106284
output:
YES 1 3 2 6 7 5 4 12 13 15 14 10 11 9 8 24 25 27 26 30 31 29 28 20 21 23 22 18 19 17 16 48 49 51 50 54 55 53 52 60 61 63 62 58 59 57 56 40 41 43 42 46 47 45 44 36 37 39 38 34 35 33 32 96 97 99 98 102 103 101 100 108 109 111 110 106 107 105 104 120 121 123 122 126 127 125 124 116 117 119 118 114 115 ...
result:
ok answer is 1
Test #47:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
152797
output:
NO
result:
ok answer is 0
Test #48:
score: 0
Accepted
time: 6ms
memory: 4776kb
input:
200000
output:
YES 1 3 2 6 7 5 4 12 13 15 14 10 11 9 8 24 25 27 26 30 31 29 28 20 21 23 22 18 19 17 16 48 49 51 50 54 55 53 52 60 61 63 62 58 59 57 56 40 41 43 42 46 47 45 44 36 37 39 38 34 35 33 32 96 97 99 98 102 103 101 100 108 109 111 110 106 107 105 104 120 121 123 122 126 127 125 124 116 117 119 118 114 115 ...
result:
ok answer is 1
Test #49:
score: 0
Accepted
time: 1ms
memory: 3556kb
input:
3073
output:
YES 1 3 2 6 7 5 4 12 13 15 14 10 11 9 8 24 25 27 26 30 31 29 28 20 21 23 22 18 19 17 16 48 49 51 50 54 55 53 52 60 61 63 62 58 59 57 56 40 41 43 42 46 47 45 44 36 37 39 38 34 35 33 32 96 97 99 98 102 103 101 100 108 109 111 110 106 107 105 104 120 121 123 122 126 127 125 124 116 117 119 118 114 115 ...
result:
ok answer is 1
Test #50:
score: 0
Accepted
time: 1ms
memory: 3924kb
input:
16383
output:
YES 1 3 2 6 7 5 4 12 13 15 14 10 11 9 8 24 25 27 26 30 31 29 28 20 21 23 22 18 19 17 16 48 49 51 50 54 55 53 52 60 61 63 62 58 59 57 56 40 41 43 42 46 47 45 44 36 37 39 38 34 35 33 32 96 97 99 98 102 103 101 100 108 109 111 110 106 107 105 104 120 121 123 122 126 127 125 124 116 117 119 118 114 115 ...
result:
ok answer is 1
Test #51:
score: 0
Accepted
time: 2ms
memory: 3948kb
input:
32767
output:
YES 1 3 2 6 7 5 4 12 13 15 14 10 11 9 8 24 25 27 26 30 31 29 28 20 21 23 22 18 19 17 16 48 49 51 50 54 55 53 52 60 61 63 62 58 59 57 56 40 41 43 42 46 47 45 44 36 37 39 38 34 35 33 32 96 97 99 98 102 103 101 100 108 109 111 110 106 107 105 104 120 121 123 122 126 127 125 124 116 117 119 118 114 115 ...
result:
ok answer is 1
Test #52:
score: 0
Accepted
time: 0ms
memory: 3800kb
input:
399
output:
YES 1 3 2 6 7 5 4 12 13 15 14 10 11 9 8 24 25 27 26 30 31 29 28 20 21 23 22 18 19 17 16 48 49 51 50 54 55 53 52 60 61 63 62 58 59 57 56 40 41 43 42 46 47 45 44 36 37 39 38 34 35 33 32 96 97 99 98 102 103 101 100 108 109 111 110 106 107 105 104 120 121 123 122 126 127 125 124 116 117 119 118 114 115 ...
result:
ok answer is 1
Test #53:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
5757
output:
NO
result:
ok answer is 0
Test #54:
score: 0
Accepted
time: 0ms
memory: 3560kb
input:
179
output:
NO
result:
ok answer is 0
Test #55:
score: 0
Accepted
time: 0ms
memory: 3568kb
input:
228
output:
YES 1 3 2 6 7 5 4 12 13 15 14 10 11 9 8 24 25 27 26 30 31 29 28 20 21 23 22 18 19 17 16 48 49 51 50 54 55 53 52 60 61 63 62 58 59 57 56 40 41 43 42 46 47 45 44 36 37 39 38 34 35 33 32 96 97 99 98 102 103 101 100 108 109 111 110 106 107 105 104 120 121 123 122 126 127 125 124 116 117 119 118 114 115 ...
result:
ok answer is 1
Extra Test:
score: 0
Extra Test Passed