QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#306542 | #8004. Bit Component | zhouhuanyi | AC ✓ | 10ms | 4688kb | C++14 | 1.0kb | 2024-01-16 21:13:00 | 2024-01-16 21:13:00 |
Judging History
answer
#include<iostream>
#include<cstdio>
#define N 262144
using namespace std;
int read()
{
char c=0;
int sum=0;
while (c<'0'||c>'9') c=getchar();
while ('0'<=c&&c<='9') sum=sum*10+c-'0',c=getchar();
return sum;
}
int n,d,F[N+1],length;
int main()
{
n=read();
if (n==1)
{
puts("YES"),puts("1");
return 0;
}
if (n==2)
{
puts("NO");
return 0;
}
while ((1<<(d+1))-1<=n) d++;
if (n!=(1<<d)-1&&n<=(1<<d)+(1<<(d-1)))
{
puts("NO");
return 0;
}
F[1]=1,F[2]=3,F[3]=2;
for (int i=3;i<=d;++i)
{
length=(1<<(i-1))-1;
for (int j=(1<<(i-1))-1;j>=1;--j)
{
if (F[j]+(1<<(i-1))==(1<<i)-1) F[++length]=(1<<(i-1));
F[++length]=F[j]+(1<<(i-1));
}
}
length=(1<<d)-1;
if (n!=(1<<d)-1)
{
for (int i=1;i<=(1<<(d-1))-1;++i)
{
if ((1<<d)+(1<<(d-1))+F[i]<=n) F[++length]=(1<<d)+(1<<(d-1))+F[i];
F[++length]=(1<<d)+F[i];
}
F[++length]=(1<<d),F[++length]=(1<<d)+(1<<(d-1));
}
puts("YES");
for (int i=1;i<=length;++i) printf("%d ",F[i]);
puts("");
return 0;
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3680kb
input:
1
output:
YES 1
result:
ok answer is 1
Test #2:
score: 0
Accepted
time: 0ms
memory: 3648kb
input:
2
output:
NO
result:
ok answer is 0
Test #3:
score: 0
Accepted
time: 0ms
memory: 3908kb
input:
3
output:
YES 1 3 2
result:
ok answer is 1
Test #4:
score: 0
Accepted
time: 0ms
memory: 3724kb
input:
4
output:
NO
result:
ok answer is 0
Test #5:
score: 0
Accepted
time: 0ms
memory: 3656kb
input:
5
output:
NO
result:
ok answer is 0
Test #6:
score: 0
Accepted
time: 0ms
memory: 3568kb
input:
6
output:
NO
result:
ok answer is 0
Test #7:
score: 0
Accepted
time: 0ms
memory: 3840kb
input:
7
output:
YES 1 3 2 6 4 7 5
result:
ok answer is 1
Test #8:
score: 0
Accepted
time: 0ms
memory: 3572kb
input:
8
output:
NO
result:
ok answer is 0
Test #9:
score: 0
Accepted
time: 0ms
memory: 3640kb
input:
9
output:
NO
result:
ok answer is 0
Test #10:
score: 0
Accepted
time: 0ms
memory: 3704kb
input:
10
output:
NO
result:
ok answer is 0
Test #11:
score: 0
Accepted
time: 0ms
memory: 3500kb
input:
11
output:
NO
result:
ok answer is 0
Test #12:
score: 0
Accepted
time: 0ms
memory: 3524kb
input:
12
output:
NO
result:
ok answer is 0
Test #13:
score: 0
Accepted
time: 0ms
memory: 3904kb
input:
13
output:
YES 1 3 2 6 4 7 5 13 9 11 10 8 12
result:
ok answer is 1
Test #14:
score: 0
Accepted
time: 0ms
memory: 3840kb
input:
14
output:
YES 1 3 2 6 4 7 5 13 9 11 14 10 8 12
result:
ok answer is 1
Test #15:
score: 0
Accepted
time: 0ms
memory: 3848kb
input:
15
output:
YES 1 3 2 6 4 7 5 13 8 15 12 14 10 11 9
result:
ok answer is 1
Test #16:
score: 0
Accepted
time: 0ms
memory: 3504kb
input:
16
output:
NO
result:
ok answer is 0
Test #17:
score: 0
Accepted
time: 0ms
memory: 3712kb
input:
17
output:
NO
result:
ok answer is 0
Test #18:
score: 0
Accepted
time: 0ms
memory: 3660kb
input:
23
output:
NO
result:
ok answer is 0
Test #19:
score: 0
Accepted
time: 0ms
memory: 3524kb
input:
24
output:
NO
result:
ok answer is 0
Test #20:
score: 0
Accepted
time: 0ms
memory: 3904kb
input:
25
output:
YES 1 3 2 6 4 7 5 13 8 15 12 14 10 11 9 25 17 19 18 22 20 23 21 16 24
result:
ok answer is 1
Test #21:
score: 0
Accepted
time: 0ms
memory: 3908kb
input:
26
output:
YES 1 3 2 6 4 7 5 13 8 15 12 14 10 11 9 25 17 19 26 18 22 20 23 21 16 24
result:
ok answer is 1
Test #22:
score: 0
Accepted
time: 0ms
memory: 3780kb
input:
27
output:
YES 1 3 2 6 4 7 5 13 8 15 12 14 10 11 9 25 17 27 19 26 18 22 20 23 21 16 24
result:
ok answer is 1
Test #23:
score: 0
Accepted
time: 0ms
memory: 3656kb
input:
40
output:
NO
result:
ok answer is 0
Test #24:
score: 0
Accepted
time: 0ms
memory: 3852kb
input:
53
output:
YES 1 3 2 6 4 7 5 13 8 15 12 14 10 11 9 25 27 26 30 28 16 31 24 29 21 23 20 22 18 19 17 49 33 51 35 50 34 38 52 36 39 53 37 45 40 47 44 46 42 43 41 32 48
result:
ok answer is 1
Test #25:
score: 0
Accepted
time: 0ms
memory: 3568kb
input:
93
output:
NO
result:
ok answer is 0
Test #26:
score: 0
Accepted
time: 0ms
memory: 3768kb
input:
105
output:
YES 1 3 2 6 4 7 5 13 8 15 12 14 10 11 9 25 27 26 30 28 16 31 24 29 21 23 20 22 18 19 17 49 51 50 54 52 55 53 61 56 32 63 48 60 62 58 59 57 41 43 42 46 44 47 40 45 37 39 36 38 34 35 33 97 65 99 67 98 66 102 70 100 68 103 71 101 69 77 104 72 79 76 78 74 75 105 73 89 91 90 94 92 80 95 88 93 85 87 84 86...
result:
ok answer is 1
Test #27:
score: 0
Accepted
time: 0ms
memory: 3568kb
input:
132
output:
NO
result:
ok answer is 0
Test #28:
score: 0
Accepted
time: 0ms
memory: 3848kb
input:
221
output:
YES 1 3 2 6 4 7 5 13 8 15 12 14 10 11 9 25 27 26 30 28 16 31 24 29 21 23 20 22 18 19 17 49 51 50 54 52 55 53 61 56 32 63 48 60 62 58 59 57 41 43 42 46 44 47 40 45 37 39 36 38 34 35 33 97 99 98 102 100 103 101 109 104 111 108 110 106 107 105 121 123 122 126 124 112 64 127 96 120 125 117 119 116 118 1...
result:
ok answer is 1
Test #29:
score: 0
Accepted
time: 0ms
memory: 3524kb
input:
373
output:
NO
result:
ok answer is 0
Test #30:
score: 0
Accepted
time: 0ms
memory: 3840kb
input:
473
output:
YES 1 3 2 6 4 7 5 13 8 15 12 14 10 11 9 25 27 26 30 28 16 31 24 29 21 23 20 22 18 19 17 49 51 50 54 52 55 53 61 56 32 63 48 60 62 58 59 57 41 43 42 46 44 47 40 45 37 39 36 38 34 35 33 97 99 98 102 100 103 101 109 104 111 108 110 106 107 105 121 123 122 126 124 112 64 127 96 120 125 117 119 116 118 1...
result:
ok answer is 1
Test #31:
score: 0
Accepted
time: 0ms
memory: 3576kb
input:
513
output:
NO
result:
ok answer is 0
Test #32:
score: 0
Accepted
time: 0ms
memory: 3936kb
input:
934
output:
YES 1 3 2 6 4 7 5 13 8 15 12 14 10 11 9 25 27 26 30 28 16 31 24 29 21 23 20 22 18 19 17 49 51 50 54 52 55 53 61 56 32 63 48 60 62 58 59 57 41 43 42 46 44 47 40 45 37 39 36 38 34 35 33 97 99 98 102 100 103 101 109 104 111 108 110 106 107 105 121 123 122 126 124 112 64 127 96 120 125 117 119 116 118 1...
result:
ok answer is 1
Test #33:
score: 0
Accepted
time: 0ms
memory: 3656kb
input:
1356
output:
NO
result:
ok answer is 0
Test #34:
score: 0
Accepted
time: 0ms
memory: 3780kb
input:
1651
output:
YES 1 3 2 6 4 7 5 13 8 15 12 14 10 11 9 25 27 26 30 28 16 31 24 29 21 23 20 22 18 19 17 49 51 50 54 52 55 53 61 56 32 63 48 60 62 58 59 57 41 43 42 46 44 47 40 45 37 39 36 38 34 35 33 97 99 98 102 100 103 101 109 104 111 108 110 106 107 105 121 123 122 126 124 112 64 127 96 120 125 117 119 116 118 1...
result:
ok answer is 1
Test #35:
score: 0
Accepted
time: 0ms
memory: 3640kb
input:
2263
output:
NO
result:
ok answer is 0
Test #36:
score: 0
Accepted
time: 0ms
memory: 3792kb
input:
3330
output:
YES 1 3 2 6 4 7 5 13 8 15 12 14 10 11 9 25 27 26 30 28 16 31 24 29 21 23 20 22 18 19 17 49 51 50 54 52 55 53 61 56 32 63 48 60 62 58 59 57 41 43 42 46 44 47 40 45 37 39 36 38 34 35 33 97 99 98 102 100 103 101 109 104 111 108 110 106 107 105 121 123 122 126 124 112 64 127 96 120 125 117 119 116 118 1...
result:
ok answer is 1
Test #37:
score: 0
Accepted
time: 0ms
memory: 3652kb
input:
4375
output:
NO
result:
ok answer is 0
Test #38:
score: 0
Accepted
time: 1ms
memory: 3848kb
input:
7989
output:
YES 1 3 2 6 4 7 5 13 8 15 12 14 10 11 9 25 27 26 30 28 16 31 24 29 21 23 20 22 18 19 17 49 51 50 54 52 55 53 61 56 32 63 48 60 62 58 59 57 41 43 42 46 44 47 40 45 37 39 36 38 34 35 33 97 99 98 102 100 103 101 109 104 111 108 110 106 107 105 121 123 122 126 124 112 64 127 96 120 125 117 119 116 118 1...
result:
ok answer is 1
Test #39:
score: 0
Accepted
time: 0ms
memory: 3528kb
input:
10925
output:
NO
result:
ok answer is 0
Test #40:
score: 0
Accepted
time: 1ms
memory: 3948kb
input:
14097
output:
YES 1 3 2 6 4 7 5 13 8 15 12 14 10 11 9 25 27 26 30 28 16 31 24 29 21 23 20 22 18 19 17 49 51 50 54 52 55 53 61 56 32 63 48 60 62 58 59 57 41 43 42 46 44 47 40 45 37 39 36 38 34 35 33 97 99 98 102 100 103 101 109 104 111 108 110 106 107 105 121 123 122 126 124 112 64 127 96 120 125 117 119 116 118 1...
result:
ok answer is 1
Test #41:
score: 0
Accepted
time: 0ms
memory: 3524kb
input:
16893
output:
NO
result:
ok answer is 0
Test #42:
score: 0
Accepted
time: 0ms
memory: 3968kb
input:
28913
output:
YES 1 3 2 6 4 7 5 13 8 15 12 14 10 11 9 25 27 26 30 28 16 31 24 29 21 23 20 22 18 19 17 49 51 50 54 52 55 53 61 56 32 63 48 60 62 58 59 57 41 43 42 46 44 47 40 45 37 39 36 38 34 35 33 97 99 98 102 100 103 101 109 104 111 108 110 106 107 105 121 123 122 126 124 112 64 127 96 120 125 117 119 116 118 1...
result:
ok answer is 1
Test #43:
score: 0
Accepted
time: 0ms
memory: 3708kb
input:
40092
output:
NO
result:
ok answer is 0
Test #44:
score: 0
Accepted
time: 0ms
memory: 4052kb
input:
54980
output:
YES 1 3 2 6 4 7 5 13 8 15 12 14 10 11 9 25 27 26 30 28 16 31 24 29 21 23 20 22 18 19 17 49 51 50 54 52 55 53 61 56 32 63 48 60 62 58 59 57 41 43 42 46 44 47 40 45 37 39 36 38 34 35 33 97 99 98 102 100 103 101 109 104 111 108 110 106 107 105 121 123 122 126 124 112 64 127 96 120 125 117 119 116 118 1...
result:
ok answer is 1
Test #45:
score: 0
Accepted
time: 0ms
memory: 3708kb
input:
88104
output:
NO
result:
ok answer is 0
Test #46:
score: 0
Accepted
time: 5ms
memory: 4244kb
input:
106284
output:
YES 1 3 2 6 4 7 5 13 8 15 12 14 10 11 9 25 27 26 30 28 16 31 24 29 21 23 20 22 18 19 17 49 51 50 54 52 55 53 61 56 32 63 48 60 62 58 59 57 41 43 42 46 44 47 40 45 37 39 36 38 34 35 33 97 99 98 102 100 103 101 109 104 111 108 110 106 107 105 121 123 122 126 124 112 64 127 96 120 125 117 119 116 118 1...
result:
ok answer is 1
Test #47:
score: 0
Accepted
time: 0ms
memory: 3648kb
input:
152797
output:
NO
result:
ok answer is 0
Test #48:
score: 0
Accepted
time: 10ms
memory: 4688kb
input:
200000
output:
YES 1 3 2 6 4 7 5 13 8 15 12 14 10 11 9 25 27 26 30 28 16 31 24 29 21 23 20 22 18 19 17 49 51 50 54 52 55 53 61 56 32 63 48 60 62 58 59 57 41 43 42 46 44 47 40 45 37 39 36 38 34 35 33 97 99 98 102 100 103 101 109 104 111 108 110 106 107 105 121 123 122 126 124 112 64 127 96 120 125 117 119 116 118 1...
result:
ok answer is 1
Test #49:
score: 0
Accepted
time: 1ms
memory: 3848kb
input:
3073
output:
YES 1 3 2 6 4 7 5 13 8 15 12 14 10 11 9 25 27 26 30 28 16 31 24 29 21 23 20 22 18 19 17 49 51 50 54 52 55 53 61 56 32 63 48 60 62 58 59 57 41 43 42 46 44 47 40 45 37 39 36 38 34 35 33 97 99 98 102 100 103 101 109 104 111 108 110 106 107 105 121 123 122 126 124 112 64 127 96 120 125 117 119 116 118 1...
result:
ok answer is 1
Test #50:
score: 0
Accepted
time: 1ms
memory: 3852kb
input:
16383
output:
YES 1 3 2 6 4 7 5 13 8 15 12 14 10 11 9 25 27 26 30 28 16 31 24 29 21 23 20 22 18 19 17 49 51 50 54 52 55 53 61 56 32 63 48 60 62 58 59 57 41 43 42 46 44 47 40 45 37 39 36 38 34 35 33 97 99 98 102 100 103 101 109 104 111 108 110 106 107 105 121 123 122 126 124 112 64 127 96 120 125 117 119 116 118 1...
result:
ok answer is 1
Test #51:
score: 0
Accepted
time: 2ms
memory: 3900kb
input:
32767
output:
YES 1 3 2 6 4 7 5 13 8 15 12 14 10 11 9 25 27 26 30 28 16 31 24 29 21 23 20 22 18 19 17 49 51 50 54 52 55 53 61 56 32 63 48 60 62 58 59 57 41 43 42 46 44 47 40 45 37 39 36 38 34 35 33 97 99 98 102 100 103 101 109 104 111 108 110 106 107 105 121 123 122 126 124 112 64 127 96 120 125 117 119 116 118 1...
result:
ok answer is 1
Test #52:
score: 0
Accepted
time: 0ms
memory: 3820kb
input:
399
output:
YES 1 3 2 6 4 7 5 13 8 15 12 14 10 11 9 25 27 26 30 28 16 31 24 29 21 23 20 22 18 19 17 49 51 50 54 52 55 53 61 56 32 63 48 60 62 58 59 57 41 43 42 46 44 47 40 45 37 39 36 38 34 35 33 97 99 98 102 100 103 101 109 104 111 108 110 106 107 105 121 123 122 126 124 112 64 127 96 120 125 117 119 116 118 1...
result:
ok answer is 1
Test #53:
score: 0
Accepted
time: 0ms
memory: 3568kb
input:
5757
output:
NO
result:
ok answer is 0
Test #54:
score: 0
Accepted
time: 0ms
memory: 3672kb
input:
179
output:
NO
result:
ok answer is 0
Test #55:
score: 0
Accepted
time: 0ms
memory: 3772kb
input:
228
output:
YES 1 3 2 6 4 7 5 13 8 15 12 14 10 11 9 25 27 26 30 28 16 31 24 29 21 23 20 22 18 19 17 49 51 50 54 52 55 53 61 56 32 63 48 60 62 58 59 57 41 43 42 46 44 47 40 45 37 39 36 38 34 35 33 97 99 98 102 100 103 101 109 104 111 108 110 106 107 105 121 123 122 126 124 112 64 127 96 120 125 117 119 116 118 1...
result:
ok answer is 1
Extra Test:
score: 0
Extra Test Passed