QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#390045#8300. Game DesignSocialPandaAC ✓1ms3724kbC++23720b2024-04-15 00:59:592024-04-15 00:59:59

Judging History

你现在查看的是最新测评结果

  • [2024-04-15 00:59:59]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3724kb
  • [2024-04-15 00:59:59]
  • 提交

answer

#include <bits/stdc++.h>
#define SIZE 200005
#define rep(i, a, b) for (int i = a; i <= b; ++i)
#define mp make_pair
#define ll long long
using namespace std;
void io() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); }
int k, cnt;
int pa[SIZE], c[SIZE], tmp[SIZE];

int dfs(int k, int f) {
	int now = ++cnt;
	pa[now] = f;
	if (k <= 2) {
		pa[++cnt] = now;
		c[cnt] = tmp[now] = 1;
		c[now] = 3 - k;
		return 1;
	}
	tmp[now] = dfs(k / 2, now) + dfs(2, now);
	c[now] = tmp[now] + (k % 2 == 0);
	return tmp[now];
}

int main() {
	io(); cin >> k;
	dfs(k, 0);
	cout << cnt << '\n';
	rep(i, 2, cnt) cout << pa[i] << ' ';
	cout << '\n';
	rep(i, 1, cnt) cout << c[i] << ' ';
}

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3592kb

input:

2

output:

2
1 
1 1 

result:

ok correct

Test #2:

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

input:

1

output:

2
1 
2 1 

result:

ok correct

Test #3:

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

input:

3

output:

5
1 2 1 4 
2 2 1 1 1 

result:

ok correct

Test #4:

score: 0
Accepted
time: 1ms
memory: 3608kb

input:

4

output:

5
1 2 1 4 
3 1 1 1 1 

result:

ok correct

Test #5:

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

input:

5

output:

5
1 2 1 4 
2 1 1 1 1 

result:

ok correct

Test #6:

score: 0
Accepted
time: 1ms
memory: 3596kb

input:

6

output:

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

result:

ok correct

Test #7:

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

input:

7

output:

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

result:

ok correct

Test #8:

score: 0
Accepted
time: 1ms
memory: 3664kb

input:

8

output:

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

result:

ok correct

Test #9:

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

input:

9

output:

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

result:

ok correct

Test #10:

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

input:

11

output:

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

result:

ok correct

Test #11:

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

input:

23

output:

11
1 2 3 4 3 6 2 8 1 10 
4 3 2 1 1 1 1 1 1 1 1 

result:

ok correct

Test #12:

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

input:

64

output:

17
1 2 3 4 5 6 5 8 4 10 3 12 2 14 1 16 
7 6 5 4 3 1 1 1 1 1 1 1 1 1 1 1 1 

result:

ok correct

Test #13:

score: 0
Accepted
time: 1ms
memory: 3596kb

input:

87

output:

17
1 2 3 4 5 6 5 8 4 10 3 12 2 14 1 16 
6 5 4 4 2 1 1 1 1 1 1 1 1 1 1 1 1 

result:

ok correct

Test #14:

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

input:

103

output:

20
1 2 3 4 5 6 7 6 9 5 11 4 13 3 15 2 17 1 19 
7 6 5 5 4 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 

result:

ok correct

Test #15:

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

input:

128

output:

20
1 2 3 4 5 6 7 6 9 5 11 4 13 3 15 2 17 1 19 
8 7 6 5 4 3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 

result:

ok correct

Test #16:

score: 0
Accepted
time: 1ms
memory: 3592kb

input:

325

output:

23
1 2 3 4 5 6 7 8 7 10 6 12 5 14 4 16 3 18 2 20 1 22 
8 8 6 6 5 4 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 

result:

ok correct

Test #17:

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

input:

567

output:

26
1 2 3 4 5 6 7 8 9 8 11 7 13 6 15 5 17 4 19 3 21 2 23 1 25 
9 8 7 7 5 4 4 3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 

result:

ok correct

Test #18:

score: 0
Accepted
time: 1ms
memory: 3688kb

input:

9999

output:

38
1 2 3 4 5 6 7 8 9 10 11 12 13 12 15 11 17 10 19 9 21 8 23 7 25 6 27 5 29 4 31 3 33 2 35 1 37 
13 12 11 10 10 9 8 7 5 4 3 3 1 1 1 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 #19:

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

input:

93256

output:

47
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 15 18 14 20 13 22 12 24 11 26 10 28 9 30 8 32 7 34 6 36 5 38 4 40 3 42 2 44 1 46 
17 16 15 13 13 12 10 10 9 8 6 5 5 3 2 1 1 1 1 1 1 1 1 1 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 #20:

score: 0
Accepted
time: 1ms
memory: 3664kb

input:

3532462

output:

65
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 21 24 20 26 19 28 18 30 17 32 16 34 15 36 14 38 13 40 12 42 11 44 10 46 9 48 8 50 7 52 6 54 5 56 4 58 3 60 2 62 1 64 
23 21 20 19 19 17 17 15 15 13 12 12 11 9 8 7 6 6 4 4 2 2 1 1 1 1 1 1 1 1 1 1 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 #21:

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

input:

54389236

output:

77
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 25 28 24 30 23 32 22 34 21 36 20 38 19 40 18 42 17 44 16 46 15 48 14 50 13 52 12 54 11 56 10 58 9 60 8 62 7 64 6 66 5 68 4 70 3 72 2 74 1 76 
27 26 24 24 22 21 20 19 18 18 17 15 15 13 12 11 10 10 8 7 6 5 5 4 2 2 1 1 1 1 1 1 1 1 ...

result:

ok correct

Test #22:

score: 0
Accepted
time: 1ms
memory: 3724kb

input:

93453967

output:

77
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 25 28 24 30 23 32 22 34 21 36 20 38 19 40 18 42 17 44 16 46 15 48 14 50 13 52 12 54 11 56 10 58 9 60 8 62 7 64 6 66 5 68 4 70 3 72 2 74 1 76 
26 25 24 23 23 22 21 19 19 17 16 15 14 13 12 11 10 10 9 8 6 6 5 3 2 1 1 1 1 1 1 1 1 1 ...

result:

ok correct

Test #23:

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

input:

1000000000

output:

89
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 29 32 28 34 27 36 26 38 25 40 24 42 23 44 22 46 21 48 20 50 19 52 18 54 17 56 16 58 15 60 14 62 13 64 12 66 11 68 10 70 9 72 8 74 7 76 6 78 5 80 4 82 3 84 2 86 1 88 
31 30 29 28 27 26 25 24 23 21 21 19 19 18 16 15 15...

result:

ok correct

Test #24:

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

input:

999999999

output:

89
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 29 32 28 34 27 36 26 38 25 40 24 42 23 44 22 46 21 48 20 50 19 52 18 54 17 56 16 58 15 60 14 62 13 64 12 66 11 68 10 70 9 72 8 74 7 76 6 78 5 80 4 82 3 84 2 86 1 88 
30 29 28 27 26 25 24 23 22 22 21 19 19 18 16 15 15...

result:

ok correct

Test #25:

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

input:

888888888

output:

89
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 29 32 28 34 27 36 26 38 25 40 24 42 23 44 22 46 21 48 20 50 19 52 18 54 17 56 16 58 15 60 14 62 13 64 12 66 11 68 10 70 9 72 8 74 7 76 6 78 5 80 4 82 3 84 2 86 1 88 
31 30 29 27 26 25 25 24 23 21 20 19 18 18 16 16 14...

result:

ok correct

Test #26:

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

input:

333333334

output:

83
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 27 30 26 32 25 34 24 36 23 38 22 40 21 42 20 44 19 46 18 48 17 50 16 52 15 54 14 56 13 58 12 60 11 62 10 64 9 66 8 68 7 70 6 72 5 74 4 76 3 78 2 80 1 82 
29 27 26 26 24 24 22 22 20 19 19 18 17 16 14 14 13 11 10 9 8 8 6 5 4...

result:

ok correct

Test #27:

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

input:

83495645

output:

77
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 25 28 24 30 23 32 22 34 21 36 20 38 19 40 18 42 17 44 16 46 15 48 14 50 13 52 12 54 11 56 10 58 9 60 8 62 7 64 6 66 5 68 4 70 3 72 2 74 1 76 
26 26 24 23 22 22 20 19 19 17 17 15 15 14 13 12 11 9 9 7 6 5 4 3 3 1 1 1 1 1 1 1 1 1 1...

result:

ok correct

Test #28:

score: 0
Accepted
time: 1ms
memory: 3596kb

input:

894567865

output:

89
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 29 32 28 34 27 36 26 38 25 40 24 42 23 44 22 46 21 48 20 50 19 52 18 54 17 56 16 58 15 60 14 62 13 64 12 66 11 68 10 70 9 72 8 74 7 76 6 78 5 80 4 82 3 84 2 86 1 88 
30 30 29 27 26 25 25 23 22 22 20 20 19 18 17 16 15...

result:

ok correct

Test #29:

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

input:

88479456

output:

77
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 25 28 24 30 23 32 22 34 21 36 20 38 19 40 18 42 17 44 16 46 15 48 14 50 13 52 12 54 11 56 10 58 9 60 8 62 7 64 6 66 5 68 4 70 3 72 2 74 1 76 
27 26 25 24 23 21 20 19 19 17 16 16 14 14 13 12 11 9 8 8 7 6 4 4 2 1 1 1 1 1 1 1 1 1 1...

result:

ok correct

Test #30:

score: 0
Accepted
time: 1ms
memory: 3724kb

input:

1000000

output:

59
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 19 22 18 24 17 26 16 28 15 30 14 32 13 34 12 36 11 38 10 40 9 42 8 44 7 46 6 48 5 50 4 52 3 54 2 56 1 58 
21 20 19 18 17 16 14 14 13 11 11 10 9 8 6 6 4 3 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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 #31:

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

input:

429085001

output:

86
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 28 31 27 33 26 35 25 37 24 39 23 41 22 43 21 45 20 47 19 49 18 51 17 53 16 55 15 57 14 59 13 61 12 63 11 65 10 67 9 69 8 71 7 73 6 75 5 77 4 79 3 81 2 83 1 85 
29 29 28 26 26 25 23 23 21 21 20 19 17 17 15 15 13 12 12 11...

result:

ok correct

Test #32:

score: 0
Accepted
time: 1ms
memory: 3664kb

input:

882138811

output:

89
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 29 32 28 34 27 36 26 38 25 40 24 42 23 44 22 46 21 48 20 50 19 52 18 54 17 56 16 58 15 60 14 62 13 64 12 66 11 68 10 70 9 72 8 74 7 76 6 78 5 80 4 82 3 84 2 86 1 88 
30 29 29 27 26 25 25 23 23 21 20 19 18 18 16 16 15...

result:

ok correct

Test #33:

score: 0
Accepted
time: 1ms
memory: 3584kb

input:

513157691

output:

86
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 28 31 27 33 26 35 25 37 24 39 23 41 22 43 21 45 20 47 19 49 18 51 17 53 16 55 15 57 14 59 13 61 12 63 11 65 10 67 9 69 8 71 7 73 6 75 5 77 4 79 3 81 2 83 1 85 
29 28 28 26 25 24 24 23 22 20 20 18 18 16 16 15 14 12 11 11...

result:

ok correct

Test #34:

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

input:

813900859

output:

89
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 29 32 28 34 27 36 26 38 25 40 24 42 23 44 22 46 21 48 20 50 19 52 18 54 17 56 16 58 15 60 14 62 13 64 12 66 11 68 10 70 9 72 8 74 7 76 6 78 5 80 4 82 3 84 2 86 1 88 
30 29 29 27 26 25 25 24 23 22 20 20 19 17 17 16 14...

result:

ok correct

Test #35:

score: 0
Accepted
time: 1ms
memory: 3608kb

input:

454848871

output:

86
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 28 31 27 33 26 35 25 37 24 39 23 41 22 43 21 45 20 47 19 49 18 51 17 53 16 55 15 57 14 59 13 61 12 63 11 65 10 67 9 69 8 71 7 73 6 75 5 77 4 79 3 81 2 83 1 85 
29 28 27 27 26 24 23 23 21 21 20 19 17 16 15 15 14 13 11 10...

result:

ok correct

Test #36:

score: 0
Accepted
time: 1ms
memory: 3592kb

input:

151401319

output:

80
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 26 29 25 31 24 33 23 35 22 37 21 39 20 41 19 43 18 45 17 47 16 49 15 51 14 53 13 55 12 57 11 59 10 61 9 63 8 65 7 67 6 69 5 71 4 73 3 75 2 77 1 79 
27 26 25 25 24 22 21 21 19 18 18 17 15 14 14 13 12 10 9 9 8 7 6 5 3 3 1 1 1 1...

result:

ok correct

Test #37:

score: 0
Accepted
time: 1ms
memory: 3600kb

input:

280898521

output:

83
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 27 30 26 32 25 34 24 36 23 38 22 40 21 42 20 44 19 46 18 48 17 50 16 52 15 54 14 56 13 58 12 60 11 62 10 64 9 66 8 68 7 70 6 72 5 74 4 76 3 78 2 80 1 82 
28 28 27 25 24 24 22 21 20 19 19 17 17 15 15 14 13 11 10 9 8 7 7 5 5...

result:

ok correct

Test #38:

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

input:

412968047

output:

86
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 28 31 27 33 26 35 25 37 24 39 23 41 22 43 21 45 20 47 19 49 18 51 17 53 16 55 15 57 14 59 13 61 12 63 11 65 10 67 9 69 8 71 7 73 6 75 5 77 4 79 3 81 2 83 1 85 
29 28 27 26 26 24 23 23 22 21 19 19 18 16 15 15 13 13 11 10...

result:

ok correct

Extra Test:

score: 0
Extra Test Passed