QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#799794#8300. Game DesignSGColinAC ✓0ms3976kbC++20796b2024-12-05 18:11:102024-12-05 18:11:11

Judging History

This is the latest submission verdict.

  • [2024-12-05 18:11:11]
  • Judged
  • Verdict: AC
  • Time: 0ms
  • Memory: 3976kb
  • [2024-12-05 18:11:10]
  • Submitted

answer

#include<bits/stdc++.h>
using namespace std;

inline int rd() {
	int x = 0;
	bool f = 0;
	char c = getchar();
	for (; !isdigit(c); c = getchar()) f |= (c == '-');
	for (; isdigit(c); c = getchar()) x = x * 10 + (c ^ 48);
	return f ? -x : x;
}

#define N 200007

int tot, fa[N], son[N];

int build(int k, int faa) {
	int u = ++tot;
	fa[u] = faa;
	--k;
	if (k == 0) {son[u] = 1; return u;}
	if (k & 1) son[u] = son[build(k, u)];
	else {
		son[u] += son[build(2, u)];
		son[u] += son[build(k / 2, u)];
	}	
	return u;
}

int main() {
	int k = rd();
	if (k == 1) {puts("2\n1\n1 2"); return 0;}
	build(k, 0);
	printf("%d\n", tot);
	for (int i = 2; i <= tot; ++i) printf("%d ", fa[i]); 
	puts("");
	for (int i = 1; i <= tot; ++i) printf("%d ", son[i]);
	return 0;
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3792kb

input:

2

output:

2
1 
1 1 

result:

ok correct

Test #2:

score: 0
Accepted
time: 0ms
memory: 3588kb

input:

1

output:

2
1
1 2

result:

ok correct

Test #3:

score: 0
Accepted
time: 0ms
memory: 3912kb

input:

3

output:

4
1 2 1 
2 1 1 1 

result:

ok correct

Test #4:

score: 0
Accepted
time: 0ms
memory: 3792kb

input:

4

output:

5
1 2 3 2 
2 2 1 1 1 

result:

ok correct

Test #5:

score: 0
Accepted
time: 0ms
memory: 3784kb

input:

5

output:

5
1 2 1 4 
2 1 1 1 1 

result:

ok correct

Test #6:

score: 0
Accepted
time: 0ms
memory: 3860kb

input:

6

output:

6
1 2 3 2 5 
2 2 1 1 1 1 

result:

ok correct

Test #7:

score: 0
Accepted
time: 0ms
memory: 3844kb

input:

7

output:

7
1 2 1 4 5 4 
3 1 1 2 1 1 1 

result:

ok correct

Test #8:

score: 0
Accepted
time: 0ms
memory: 3792kb

input:

8

output:

8
1 2 3 2 5 6 5 
3 3 1 1 2 1 1 1 

result:

ok correct

Test #9:

score: 0
Accepted
time: 0ms
memory: 3860kb

input:

9

output:

8
1 2 1 4 5 6 5 
3 1 1 2 2 1 1 1 

result:

ok correct

Test #10:

score: 0
Accepted
time: 0ms
memory: 3976kb

input:

11

output:

8
1 2 1 4 5 4 7 
3 1 1 2 1 1 1 1 

result:

ok correct

Test #11:

score: 0
Accepted
time: 0ms
memory: 3852kb

input:

23

output:

11
1 2 1 4 5 4 7 8 7 10 
4 1 1 3 1 1 2 1 1 1 1 

result:

ok correct

Test #12:

score: 0
Accepted
time: 0ms
memory: 3800kb

input:

64

output:

17
1 2 3 2 5 6 5 8 9 8 11 12 11 14 15 14 
6 6 1 1 5 1 1 4 1 1 3 1 1 2 1 1 1 

result:

ok correct

Test #13:

score: 0
Accepted
time: 0ms
memory: 3976kb

input:

87

output:

18
1 2 1 4 5 4 7 8 7 10 11 12 11 14 15 16 15 
6 1 1 5 1 1 4 1 1 3 3 1 1 2 2 1 1 1 

result:

ok correct

Test #14:

score: 0
Accepted
time: 0ms
memory: 3852kb

input:

103

output:

18
1 2 1 4 5 4 7 8 7 10 11 12 11 14 15 14 17 
6 1 1 5 1 1 4 1 1 3 3 1 1 2 1 1 1 1 

result:

ok correct

Test #15:

score: 0
Accepted
time: 0ms
memory: 3852kb

input:

128

output:

20
1 2 3 2 5 6 5 8 9 8 11 12 11 14 15 14 17 18 17 
7 7 1 1 6 1 1 5 1 1 4 1 1 3 1 1 2 1 1 1 

result:

ok correct

Test #16:

score: 0
Accepted
time: 0ms
memory: 3852kb

input:

325

output:

25
1 2 1 4 5 6 5 8 9 10 9 12 13 12 15 16 15 18 19 18 21 22 23 22 
8 1 1 7 7 1 1 6 6 1 1 5 1 1 4 1 1 3 1 1 2 2 1 1 1 

result:

ok correct

Test #17:

score: 0
Accepted
time: 0ms
memory: 3916kb

input:

567

output:

28
1 2 1 4 5 4 7 8 7 10 11 12 11 14 15 16 15 18 19 20 19 22 23 22 25 26 25 
9 1 1 8 1 1 7 1 1 6 6 1 1 5 5 1 1 4 4 1 1 3 1 1 2 1 1 1 

result:

ok correct

Test #18:

score: 0
Accepted
time: 0ms
memory: 3820kb

input:

9999

output:

41
1 2 1 4 5 4 7 8 7 10 11 10 13 14 15 14 17 18 17 20 21 20 23 24 23 26 27 28 27 30 31 32 31 34 35 36 35 38 39 38 
13 1 1 12 1 1 11 1 1 10 1 1 9 9 1 1 8 1 1 7 1 1 6 1 1 5 5 1 1 4 4 1 1 3 3 1 1 2 1 1 1 

result:

ok correct

Test #19:

score: 0
Accepted
time: 0ms
memory: 3852kb

input:

93256

output:

53
1 2 3 2 5 6 5 8 9 8 11 12 13 12 15 16 15 18 19 18 21 22 23 22 25 26 25 28 29 28 31 32 31 34 35 36 35 38 39 40 39 42 43 42 45 46 47 46 49 50 51 50 
16 16 1 1 15 1 1 14 1 1 13 13 1 1 12 1 1 11 1 1 10 10 1 1 9 1 1 8 1 1 7 1 1 6 6 1 1 5 5 1 1 4 1 1 3 3 1 1 2 2 1 1 1 

result:

ok correct

Test #20:

score: 0
Accepted
time: 0ms
memory: 3848kb

input:

3532462

output:

75
1 2 3 2 5 6 7 6 9 10 11 10 13 14 15 14 17 18 17 20 21 22 21 24 25 24 27 28 29 28 31 32 31 34 35 36 35 38 39 40 39 42 43 42 45 46 45 48 49 50 49 52 53 54 53 56 57 58 57 60 61 62 61 64 65 64 67 68 69 68 71 72 71 74 
21 21 1 1 20 20 1 1 19 19 1 1 18 18 1 1 17 1 1 16 16 1 1 15 1 1 14 14 1 1 13 1 1 12...

result:

ok correct

Test #21:

score: 0
Accepted
time: 0ms
memory: 3796kb

input:

54389236

output:

90
1 2 3 2 5 6 5 8 9 10 9 12 13 12 15 16 17 16 19 20 21 20 23 24 25 24 27 28 29 28 31 32 33 32 35 36 35 38 39 38 41 42 43 42 45 46 45 48 49 50 49 52 53 54 53 56 57 58 57 60 61 62 61 64 65 64 67 68 69 68 71 72 73 72 75 76 77 76 79 80 81 80 83 84 83 86 87 86 89 
25 25 1 1 24 1 1 23 23 1 1 22 1 1 21 21...

result:

ok correct

Test #22:

score: 0
Accepted
time: 0ms
memory: 3768kb

input:

93453967

output:

89
1 2 1 4 5 4 7 8 7 10 11 10 13 14 15 14 17 18 17 20 21 20 23 24 25 24 27 28 27 30 31 32 31 34 35 36 35 38 39 40 39 42 43 44 43 46 47 48 47 50 51 52 51 54 55 56 55 58 59 60 59 62 63 62 65 66 65 68 69 68 71 72 73 72 75 76 75 78 79 78 81 82 83 82 85 86 87 86 
26 1 1 25 1 1 24 1 1 23 1 1 22 22 1 1 21 ...

result:

ok correct

Test #23:

score: 0
Accepted
time: 0ms
memory: 3920kb

input:

1000000000

output:

98
1 2 3 2 5 6 5 8 9 8 11 12 11 14 15 14 17 18 17 20 21 20 23 24 23 26 27 26 29 30 31 30 33 34 33 36 37 38 37 40 41 40 43 44 43 46 47 48 47 50 51 52 51 54 55 54 57 58 59 58 61 62 61 64 65 66 65 68 69 70 69 72 73 72 75 76 75 78 79 80 79 82 83 84 83 86 87 88 87 90 91 90 93 94 95 94 97 
29 29 1 1 28 1 ...

result:

ok correct

Test #24:

score: 0
Accepted
time: 0ms
memory: 3792kb

input:

999999999

output:

97
1 2 1 4 5 4 7 8 7 10 11 10 13 14 13 16 17 16 19 20 19 22 23 22 25 26 25 28 29 30 29 32 33 32 35 36 37 36 39 40 39 42 43 42 45 46 47 46 49 50 51 50 53 54 53 56 57 58 57 60 61 60 63 64 65 64 67 68 69 68 71 72 71 74 75 74 77 78 79 78 81 82 83 82 85 86 87 86 89 90 89 92 93 94 93 96 
29 1 1 28 1 1 27 ...

result:

ok correct

Test #25:

score: 0
Accepted
time: 0ms
memory: 3912kb

input:

888888888

output:

103
1 2 3 2 5 6 5 8 9 8 11 12 13 12 15 16 17 16 19 20 21 20 23 24 23 26 27 26 29 30 29 32 33 34 33 36 37 38 37 40 41 42 41 44 45 46 45 48 49 48 51 52 53 52 55 56 55 58 59 60 59 62 63 64 63 66 67 66 69 70 71 70 73 74 75 74 77 78 79 78 81 82 83 82 85 86 87 86 89 90 89 92 93 92 95 96 97 96 99 100 99 10...

result:

ok correct

Test #26:

score: 0
Accepted
time: 0ms
memory: 3852kb

input:

333333334

output:

98
1 2 3 2 5 6 7 6 9 10 11 10 13 14 13 16 17 18 17 20 21 20 23 24 25 24 27 28 27 30 31 32 31 34 35 36 35 38 39 38 41 42 41 44 45 44 47 48 47 50 51 52 51 54 55 54 57 58 57 60 61 62 61 64 65 66 65 68 69 70 69 72 73 74 73 76 77 76 79 80 81 80 83 84 85 84 87 88 89 88 91 92 93 92 95 96 95 
28 28 1 1 27 2...

result:

ok correct

Test #27:

score: 0
Accepted
time: 0ms
memory: 3868kb

input:

83495645

output:

90
1 2 1 4 5 6 5 8 9 10 9 12 13 14 13 16 17 18 17 20 21 20 23 24 25 24 27 28 29 28 31 32 31 34 35 36 35 38 39 38 41 42 43 42 45 46 45 48 49 48 51 52 51 54 55 54 57 58 57 60 61 62 61 64 65 64 67 68 69 68 71 72 73 72 75 76 77 76 79 80 81 80 83 84 85 84 87 88 87 
26 1 1 25 25 1 1 24 24 1 1 23 23 1 1 22...

result:

ok correct

Test #28:

score: 0
Accepted
time: 0ms
memory: 3788kb

input:

894567865

output:

98
1 2 1 4 5 6 5 8 9 8 11 12 13 12 15 16 17 16 19 20 21 20 23 24 23 26 27 28 27 30 31 32 31 34 35 34 37 38 39 38 41 42 41 44 45 44 47 48 47 50 51 50 53 54 53 56 57 56 59 60 61 60 63 64 63 66 67 66 69 70 71 70 73 74 73 76 77 78 77 80 81 80 83 84 85 84 87 88 87 90 91 92 91 94 95 94 97 
29 1 1 28 28 1 ...

result:

ok correct

Test #29:

score: 0
Accepted
time: 0ms
memory: 3812kb

input:

88479456

output:

87
1 2 3 2 5 6 5 8 9 8 11 12 11 14 15 14 17 18 19 18 21 22 23 22 25 26 27 26 29 30 29 32 33 34 33 36 37 38 37 40 41 40 43 44 45 44 47 48 47 50 51 50 53 54 53 56 57 56 59 60 61 60 63 64 65 64 67 68 67 70 71 70 73 74 73 76 77 78 77 80 81 80 83 84 85 84 
26 26 1 1 25 1 1 24 1 1 23 1 1 22 1 1 21 21 1 1 ...

result:

ok correct

Test #30:

score: 0
Accepted
time: 0ms
memory: 3792kb

input:

1000000

output:

62
1 2 3 2 5 6 5 8 9 8 11 12 11 14 15 14 17 18 17 20 21 22 21 24 25 24 27 28 27 30 31 32 31 34 35 34 37 38 37 40 41 40 43 44 43 46 47 48 47 50 51 50 53 54 55 54 57 58 59 58 61 
19 19 1 1 18 1 1 17 1 1 16 1 1 15 1 1 14 1 1 13 13 1 1 12 1 1 11 1 1 10 10 1 1 9 1 1 8 1 1 7 1 1 6 1 1 5 5 1 1 4 1 1 3 3 1 ...

result:

ok correct

Test #31:

score: 0
Accepted
time: 0ms
memory: 3856kb

input:

429085001

output:

94
1 2 1 4 5 6 5 8 9 8 11 12 13 12 15 16 15 18 19 18 21 22 23 22 25 26 25 28 29 30 29 32 33 32 35 36 35 38 39 38 41 42 43 42 45 46 45 48 49 50 49 52 53 52 55 56 57 56 59 60 61 60 63 64 63 66 67 66 69 70 71 70 73 74 73 76 77 76 79 80 81 80 83 84 85 84 87 88 87 90 91 90 93 
28 1 1 27 27 1 1 26 1 1 25 ...

result:

ok correct

Test #32:

score: 0
Accepted
time: 0ms
memory: 3860kb

input:

882138811

output:

100
1 2 1 4 5 4 7 8 9 8 11 12 13 12 15 16 17 16 19 20 21 20 23 24 23 26 27 28 27 30 31 30 33 34 35 34 37 38 39 38 41 42 43 42 45 46 47 46 49 50 49 52 53 54 53 56 57 56 59 60 59 62 63 62 65 66 67 66 69 70 69 72 73 74 73 76 77 76 79 80 79 82 83 84 83 86 87 86 89 90 89 92 93 94 93 96 97 96 99 
29 1 1 2...

result:

ok correct

Test #33:

score: 0
Accepted
time: 0ms
memory: 3856kb

input:

513157691

output:

96
1 2 1 4 5 4 7 8 9 8 11 12 13 12 15 16 17 16 19 20 21 20 23 24 23 26 27 26 29 30 29 32 33 34 33 36 37 36 39 40 41 40 43 44 43 46 47 48 47 50 51 50 53 54 53 56 57 56 59 60 61 60 63 64 65 64 67 68 67 70 71 72 71 74 75 74 77 78 77 80 81 82 81 84 85 84 87 88 89 88 91 92 93 92 95 
28 1 1 27 1 1 26 26 1...

result:

ok correct

Test #34:

score: 0
Accepted
time: 0ms
memory: 3820kb

input:

813900859

output:

95
1 2 1 4 5 4 7 8 9 8 11 12 13 12 15 16 17 16 19 20 21 20 23 24 23 26 27 26 29 30 29 32 33 32 35 36 37 36 39 40 39 42 43 42 45 46 47 46 49 50 49 52 53 52 55 56 57 56 59 60 61 60 63 64 63 66 67 66 69 70 69 72 73 72 75 76 75 78 79 80 79 82 83 82 85 86 85 88 89 88 91 92 91 94 
29 1 1 28 1 1 27 27 1 1 ...

result:

ok correct

Test #35:

score: 0
Accepted
time: 0ms
memory: 3840kb

input:

454848871

output:

95
1 2 1 4 5 4 7 8 7 10 11 12 11 14 15 14 17 18 19 18 21 22 23 22 25 26 25 28 29 30 29 32 33 32 35 36 35 38 39 38 41 42 43 42 45 46 47 46 49 50 51 50 53 54 53 56 57 56 59 60 59 62 63 64 63 66 67 68 67 70 71 72 71 74 75 74 77 78 77 80 81 80 83 84 85 84 87 88 89 88 91 92 91 94 
28 1 1 27 1 1 26 1 1 25...

result:

ok correct

Test #36:

score: 0
Accepted
time: 0ms
memory: 3856kb

input:

151401319

output:

89
1 2 1 4 5 4 7 8 7 10 11 12 11 14 15 14 17 18 19 18 21 22 23 22 25 26 25 28 29 30 29 32 33 34 33 36 37 36 39 40 39 42 43 44 43 46 47 48 47 50 51 50 53 54 53 56 57 56 59 60 61 60 63 64 65 64 67 68 67 70 71 70 73 74 73 76 77 76 79 80 79 82 83 84 83 86 87 86 
27 1 1 26 1 1 25 1 1 24 24 1 1 23 1 1 22 ...

result:

ok correct

Test #37:

score: 0
Accepted
time: 0ms
memory: 3848kb

input:

280898521

output:

97
1 2 1 4 5 6 5 8 9 8 11 12 13 12 15 16 17 16 19 20 19 22 23 24 23 26 27 28 27 30 31 32 31 34 35 36 35 38 39 38 41 42 43 42 45 46 45 48 49 50 49 52 53 52 55 56 55 58 59 58 61 62 63 62 65 66 67 66 69 70 71 70 73 74 75 74 77 78 79 78 81 82 81 84 85 86 85 88 89 88 91 92 91 94 95 94 
28 1 1 27 27 1 1 2...

result:

ok correct

Test #38:

score: 0
Accepted
time: 0ms
memory: 3836kb

input:

412968047

output:

94
1 2 1 4 5 4 7 8 7 10 11 10 13 14 15 14 17 18 19 18 21 22 23 22 25 26 25 28 29 28 31 32 31 34 35 36 35 38 39 38 41 42 41 44 45 46 45 48 49 50 49 52 53 52 55 56 57 56 59 60 59 62 63 64 63 66 67 68 67 70 71 72 71 74 75 74 77 78 77 80 81 82 81 84 85 84 87 88 87 90 91 90 93 
28 1 1 27 1 1 26 1 1 25 1 ...

result:

ok correct

Extra Test:

score: 0
Extra Test Passed