QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#371698#8300. Game Designucup-team052#AC ✓1ms3924kbC++23688b2024-03-30 15:02:372024-03-30 15:02:57

Judging History

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

  • [2024-03-30 15:02:57]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3924kb
  • [2024-03-30 15:02:37]
  • 提交

answer

#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define per(i,a,b) for(int i=(a);i>=(b);--i)
using namespace std;
using LL=long long;
const int INF=1e9;
const int N=100005;
int fa[N],val[N];
int main(){
#ifdef xay5421
	freopen("a.in","r",stdin);
#endif
	int K;
	cin>>K;
	int idx=2,dp=1;
	val[1]=INF;
	val[2]=1;
	int root=2;
	per(i,__lg(K)-1,0){
		fa[root]=++idx;
		dp+=1;
		val[idx]=K>>i&1?dp:INF;
		root=idx;
		fa[idx+1]=root,val[idx+1]=1;
		fa[idx+2]=idx+1,val[idx+2]=1;
		idx+=2;
	}
	fa[root]=1;
	printf("%d\n",idx);
	rep(i,2,idx)printf("%d%c",fa[i],i==idx?'\n':' ');
	rep(i,1,idx)printf("%d%c",val[i],i==idx?'\n':' ');
	return 0;
}

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2

output:

5
3 1 3 4
1000000000 1 1000000000 1 1

result:

ok correct

Test #2:

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

input:

1

output:

2
1
1000000000 1

result:

ok correct

Test #3:

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

input:

3

output:

5
3 1 3 4
1000000000 1 2 1 1

result:

ok correct

Test #4:

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

input:

4

output:

8
3 6 3 4 1 6 7
1000000000 1 1000000000 1 1 1000000000 1 1

result:

ok correct

Test #5:

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

input:

5

output:

8
3 6 3 4 1 6 7
1000000000 1 1000000000 1 1 3 1 1

result:

ok correct

Test #6:

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

input:

6

output:

8
3 6 3 4 1 6 7
1000000000 1 2 1 1 1000000000 1 1

result:

ok correct

Test #7:

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

input:

7

output:

8
3 6 3 4 1 6 7
1000000000 1 2 1 1 3 1 1

result:

ok correct

Test #8:

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

input:

8

output:

11
3 6 3 4 9 6 7 1 9 10
1000000000 1 1000000000 1 1 1000000000 1 1 1000000000 1 1

result:

ok correct

Test #9:

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

input:

9

output:

11
3 6 3 4 9 6 7 1 9 10
1000000000 1 1000000000 1 1 1000000000 1 1 4 1 1

result:

ok correct

Test #10:

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

input:

11

output:

11
3 6 3 4 9 6 7 1 9 10
1000000000 1 1000000000 1 1 3 1 1 4 1 1

result:

ok correct

Test #11:

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

input:

23

output:

14
3 6 3 4 9 6 7 12 9 10 1 12 13
1000000000 1 1000000000 1 1 3 1 1 4 1 1 5 1 1

result:

ok correct

Test #12:

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

input:

64

output:

20
3 6 3 4 9 6 7 12 9 10 15 12 13 18 15 16 1 18 19
1000000000 1 1000000000 1 1 1000000000 1 1 1000000000 1 1 1000000000 1 1 1000000000 1 1 1000000000 1 1

result:

ok correct

Test #13:

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

input:

87

output:

20
3 6 3 4 9 6 7 12 9 10 15 12 13 18 15 16 1 18 19
1000000000 1 1000000000 1 1 3 1 1 1000000000 1 1 5 1 1 6 1 1 7 1 1

result:

ok correct

Test #14:

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

input:

103

output:

20
3 6 3 4 9 6 7 12 9 10 15 12 13 18 15 16 1 18 19
1000000000 1 2 1 1 1000000000 1 1 1000000000 1 1 5 1 1 6 1 1 7 1 1

result:

ok correct

Test #15:

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

input:

128

output:

23
3 6 3 4 9 6 7 12 9 10 15 12 13 18 15 16 21 18 19 1 21 22
1000000000 1 1000000000 1 1 1000000000 1 1 1000000000 1 1 1000000000 1 1 1000000000 1 1 1000000000 1 1 1000000000 1 1

result:

ok correct

Test #16:

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

input:

325

output:

26
3 6 3 4 9 6 7 12 9 10 15 12 13 18 15 16 21 18 19 24 21 22 1 24 25
1000000000 1 1000000000 1 1 3 1 1 1000000000 1 1 1000000000 1 1 1000000000 1 1 7 1 1 1000000000 1 1 9 1 1

result:

ok correct

Test #17:

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

input:

567

output:

29
3 6 3 4 9 6 7 12 9 10 15 12 13 18 15 16 21 18 19 24 21 22 27 24 25 1 27 28
1000000000 1 1000000000 1 1 1000000000 1 1 1000000000 1 1 5 1 1 6 1 1 1000000000 1 1 8 1 1 9 1 1 10 1 1

result:

ok correct

Test #18:

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

input:

9999

output:

41
3 6 3 4 9 6 7 12 9 10 15 12 13 18 15 16 21 18 19 24 21 22 27 24 25 30 27 28 33 30 31 36 33 34 39 36 37 1 39 40
1000000000 1 1000000000 1 1 1000000000 1 1 4 1 1 5 1 1 6 1 1 1000000000 1 1 1000000000 1 1 1000000000 1 1 1000000000 1 1 11 1 1 12 1 1 13 1 1 14 1 1

result:

ok correct

Test #19:

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

input:

93256

output:

50
3 6 3 4 9 6 7 12 9 10 15 12 13 18 15 16 21 18 19 24 21 22 27 24 25 30 27 28 33 30 31 36 33 34 39 36 37 42 39 40 45 42 43 48 45 46 1 48 49
1000000000 1 1000000000 1 1 3 1 1 4 1 1 1000000000 1 1 6 1 1 7 1 1 1000000000 1 1 1000000000 1 1 1000000000 1 1 11 1 1 1000000000 1 1 1000000000 1 1 14 1 1 100...

result:

ok correct

Test #20:

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

input:

3532462

output:

65
3 6 3 4 9 6 7 12 9 10 15 12 13 18 15 16 21 18 19 24 21 22 27 24 25 30 27 28 33 30 31 36 33 34 39 36 37 42 39 40 45 42 43 48 45 46 51 48 49 54 51 52 57 54 55 60 57 58 63 60 61 1 63 64
1000000000 1 2 1 1 1000000000 1 1 4 1 1 1000000000 1 1 6 1 1 7 1 1 8 1 1 9 1 1 1000000000 1 1 1000000000 1 1 12 1 ...

result:

ok correct

Test #21:

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

input:

54389236

output:

77
3 6 3 4 9 6 7 12 9 10 15 12 13 18 15 16 21 18 19 24 21 22 27 24 25 30 27 28 33 30 31 36 33 34 39 36 37 42 39 40 45 42 43 48 45 46 51 48 49 54 51 52 57 54 55 60 57 58 63 60 61 66 63 64 69 66 67 72 69 70 75 72 73 1 75 76
1000000000 1 2 1 1 1000000000 1 1 1000000000 1 1 5 1 1 6 1 1 7 1 1 8 1 1 10000...

result:

ok correct

Test #22:

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

input:

93453967

output:

80
3 6 3 4 9 6 7 12 9 10 15 12 13 18 15 16 21 18 19 24 21 22 27 24 25 30 27 28 33 30 31 36 33 34 39 36 37 42 39 40 45 42 43 48 45 46 51 48 49 54 51 52 57 54 55 60 57 58 63 60 61 66 63 64 69 66 67 72 69 70 75 72 73 78 75 76 1 78 79
1000000000 1 1000000000 1 1 3 1 1 4 1 1 1000000000 1 1 1000000000 1 1...

result:

ok correct

Test #23:

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

input:

1000000000

output:

89
3 6 3 4 9 6 7 12 9 10 15 12 13 18 15 16 21 18 19 24 21 22 27 24 25 30 27 28 33 30 31 36 33 34 39 36 37 42 39 40 45 42 43 48 45 46 51 48 49 54 51 52 57 54 55 60 57 58 63 60 61 66 63 64 69 66 67 72 69 70 75 72 73 78 75 76 81 78 79 84 81 82 87 84 85 1 87 88
1000000000 1 2 1 1 3 1 1 1000000000 1 1 5 ...

result:

ok correct

Test #24:

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

input:

999999999

output:

89
3 6 3 4 9 6 7 12 9 10 15 12 13 18 15 16 21 18 19 24 21 22 27 24 25 30 27 28 33 30 31 36 33 34 39 36 37 42 39 40 45 42 43 48 45 46 51 48 49 54 51 52 57 54 55 60 57 58 63 60 61 66 63 64 69 66 67 72 69 70 75 72 73 78 75 76 81 78 79 84 81 82 87 84 85 1 87 88
1000000000 1 2 1 1 3 1 1 1000000000 1 1 5 ...

result:

ok correct

Test #25:

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

input:

888888888

output:

89
3 6 3 4 9 6 7 12 9 10 15 12 13 18 15 16 21 18 19 24 21 22 27 24 25 30 27 28 33 30 31 36 33 34 39 36 37 42 39 40 45 42 43 48 45 46 51 48 49 54 51 52 57 54 55 60 57 58 63 60 61 66 63 64 69 66 67 72 69 70 75 72 73 78 75 76 81 78 79 84 81 82 87 84 85 1 87 88
1000000000 1 2 1 1 1000000000 1 1 4 1 1 10...

result:

ok correct

Test #26:

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

input:

333333334

output:

86
3 6 3 4 9 6 7 12 9 10 15 12 13 18 15 16 21 18 19 24 21 22 27 24 25 30 27 28 33 30 31 36 33 34 39 36 37 42 39 40 45 42 43 48 45 46 51 48 49 54 51 52 57 54 55 60 57 58 63 60 61 66 63 64 69 66 67 72 69 70 75 72 73 78 75 76 81 78 79 84 81 82 1 84 85
1000000000 1 1000000000 1 1 1000000000 1 1 4 1 1 5 ...

result:

ok correct

Test #27:

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

input:

83495645

output:

80
3 6 3 4 9 6 7 12 9 10 15 12 13 18 15 16 21 18 19 24 21 22 27 24 25 30 27 28 33 30 31 36 33 34 39 36 37 42 39 40 45 42 43 48 45 46 51 48 49 54 51 52 57 54 55 60 57 58 63 60 61 66 63 64 69 66 67 72 69 70 75 72 73 78 75 76 1 78 79
1000000000 1 1000000000 1 1 1000000000 1 1 4 1 1 5 1 1 6 1 1 7 1 1 8 ...

result:

ok correct

Test #28:

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

input:

894567865

output:

89
3 6 3 4 9 6 7 12 9 10 15 12 13 18 15 16 21 18 19 24 21 22 27 24 25 30 27 28 33 30 31 36 33 34 39 36 37 42 39 40 45 42 43 48 45 46 51 48 49 54 51 52 57 54 55 60 57 58 63 60 61 66 63 64 69 66 67 72 69 70 75 72 73 78 75 76 81 78 79 84 81 82 87 84 85 1 87 88
1000000000 1 2 1 1 1000000000 1 1 4 1 1 10...

result:

ok correct

Test #29:

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

input:

88479456

output:

80
3 6 3 4 9 6 7 12 9 10 15 12 13 18 15 16 21 18 19 24 21 22 27 24 25 30 27 28 33 30 31 36 33 34 39 36 37 42 39 40 45 42 43 48 45 46 51 48 49 54 51 52 57 54 55 60 57 58 63 60 61 66 63 64 69 66 67 72 69 70 75 72 73 78 75 76 1 78 79
1000000000 1 1000000000 1 1 3 1 1 1000000000 1 1 5 1 1 1000000000 1 1...

result:

ok correct

Test #30:

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

input:

1000000

output:

59
3 6 3 4 9 6 7 12 9 10 15 12 13 18 15 16 21 18 19 24 21 22 27 24 25 30 27 28 33 30 31 36 33 34 39 36 37 42 39 40 45 42 43 48 45 46 51 48 49 54 51 52 57 54 55 1 57 58
1000000000 1 2 1 1 3 1 1 4 1 1 1000000000 1 1 6 1 1 1000000000 1 1 1000000000 1 1 1000000000 1 1 1000000000 1 1 11 1 1 1000000000 1 ...

result:

ok correct

Test #31:

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

input:

429085001

output:

86
3 6 3 4 9 6 7 12 9 10 15 12 13 18 15 16 21 18 19 24 21 22 27 24 25 30 27 28 33 30 31 36 33 34 39 36 37 42 39 40 45 42 43 48 45 46 51 48 49 54 51 52 57 54 55 60 57 58 63 60 61 66 63 64 69 66 67 72 69 70 75 72 73 78 75 76 81 78 79 84 81 82 1 84 85
1000000000 1 2 1 1 1000000000 1 1 1000000000 1 1 5 ...

result:

ok correct

Test #32:

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

input:

882138811

output:

89
3 6 3 4 9 6 7 12 9 10 15 12 13 18 15 16 21 18 19 24 21 22 27 24 25 30 27 28 33 30 31 36 33 34 39 36 37 42 39 40 45 42 43 48 45 46 51 48 49 54 51 52 57 54 55 60 57 58 63 60 61 66 63 64 69 66 67 72 69 70 75 72 73 78 75 76 81 78 79 84 81 82 87 84 85 1 87 88
1000000000 1 2 1 1 1000000000 1 1 4 1 1 10...

result:

ok correct

Test #33:

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

input:

513157691

output:

86
3 6 3 4 9 6 7 12 9 10 15 12 13 18 15 16 21 18 19 24 21 22 27 24 25 30 27 28 33 30 31 36 33 34 39 36 37 42 39 40 45 42 43 48 45 46 51 48 49 54 51 52 57 54 55 60 57 58 63 60 61 66 63 64 69 66 67 72 69 70 75 72 73 78 75 76 81 78 79 84 81 82 1 84 85
1000000000 1 2 1 1 3 1 1 4 1 1 1000000000 1 1 6 1 1...

result:

ok correct

Test #34:

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

input:

813900859

output:

89
3 6 3 4 9 6 7 12 9 10 15 12 13 18 15 16 21 18 19 24 21 22 27 24 25 30 27 28 33 30 31 36 33 34 39 36 37 42 39 40 45 42 43 48 45 46 51 48 49 54 51 52 57 54 55 60 57 58 63 60 61 66 63 64 69 66 67 72 69 70 75 72 73 78 75 76 81 78 79 84 81 82 87 84 85 1 87 88
1000000000 1 2 1 1 1000000000 1 1 10000000...

result:

ok correct

Test #35:

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

input:

454848871

output:

86
3 6 3 4 9 6 7 12 9 10 15 12 13 18 15 16 21 18 19 24 21 22 27 24 25 30 27 28 33 30 31 36 33 34 39 36 37 42 39 40 45 42 43 48 45 46 51 48 49 54 51 52 57 54 55 60 57 58 63 60 61 66 63 64 69 66 67 72 69 70 75 72 73 78 75 76 81 78 79 84 81 82 1 84 85
1000000000 1 2 1 1 1000000000 1 1 4 1 1 5 1 1 10000...

result:

ok correct

Test #36:

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

input:

151401319

output:

83
3 6 3 4 9 6 7 12 9 10 15 12 13 18 15 16 21 18 19 24 21 22 27 24 25 30 27 28 33 30 31 36 33 34 39 36 37 42 39 40 45 42 43 48 45 46 51 48 49 54 51 52 57 54 55 60 57 58 63 60 61 66 63 64 69 66 67 72 69 70 75 72 73 78 75 76 81 78 79 1 81 82
1000000000 1 1000000000 1 1 1000000000 1 1 4 1 1 1000000000 ...

result:

ok correct

Test #37:

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

input:

280898521

output:

86
3 6 3 4 9 6 7 12 9 10 15 12 13 18 15 16 21 18 19 24 21 22 27 24 25 30 27 28 33 30 31 36 33 34 39 36 37 42 39 40 45 42 43 48 45 46 51 48 49 54 51 52 57 54 55 60 57 58 63 60 61 66 63 64 69 66 67 72 69 70 75 72 73 78 75 76 81 78 79 84 81 82 1 84 85
1000000000 1 1000000000 1 1 1000000000 1 1 10000000...

result:

ok correct

Test #38:

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

input:

412968047

output:

86
3 6 3 4 9 6 7 12 9 10 15 12 13 18 15 16 21 18 19 24 21 22 27 24 25 30 27 28 33 30 31 36 33 34 39 36 37 42 39 40 45 42 43 48 45 46 51 48 49 54 51 52 57 54 55 60 57 58 63 60 61 66 63 64 69 66 67 72 69 70 75 72 73 78 75 76 81 78 79 84 81 82 1 84 85
1000000000 1 2 1 1 1000000000 1 1 1000000000 1 1 10...

result:

ok correct

Extra Test:

score: 0
Extra Test Passed