QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#409339#8300. Game DesignsmlAC ✓1ms3724kbC++20979b2024-05-11 22:02:472024-05-11 22:02:47

Judging History

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

  • [2024-05-11 22:02:47]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3724kb
  • [2024-05-11 22:02:47]
  • 提交

answer

#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=1e5+10;
int fa[N],val[N];
void solve()
{
    int k;
    cin>>k;
    if(k==1){
       cout<<2<<'\n';
       cout<<1<<'\n';
       cout<<1<<' '<<2<<'\n';
       return;
    }
    else{
    	int mx;
    	for(int i=32;i>=0;i--) if(k>>i&1){
    		mx=i;
    		break;
		}
	//	cout<<mx<<endl;
	//	int pt=1;
		int tot=3*mx+1;
		int sum=1;
		int pre=tot;
		for(int i=mx-1;i>=0;i--)
		{
			sum++;
			tot-=3;
			if(k>>i&1) val[tot]=sum;
			else val[tot]=1e5;
			fa[pre]=tot;
			pre=tot;
			fa[tot+1]=tot;
			fa[tot+2]=tot+1;
		}
		cout<<3*mx+1<<'\n';
		tot=3*mx+1;
		for(int i=2;i<=tot;i++) cout<<fa[i]<<' ';
		cout<<'\n';
		for(int i=1;i<=tot;i++){
			if(!val[i]) cout<<1<<' ';
			else cout<<val[i]<<' ';
		}
		cout<<'\n';
	}
}
signed main()
{
	ios::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	int t=1;
//	cin>>t;
	while(t--) solve();
	return 0;
}

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

詳細信息

Test #1:

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

input:

2

output:

4
1 2 1 
100000 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: 3600kb

input:

3

output:

4
1 2 1 
2 1 1 1 

result:

ok correct

Test #4:

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

input:

4

output:

7
1 2 1 4 5 4 
100000 1 1 100000 1 1 1 

result:

ok correct

Test #5:

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

input:

5

output:

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

result:

ok correct

Test #6:

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

input:

6

output:

7
1 2 1 4 5 4 
100000 1 1 2 1 1 1 

result:

ok correct

Test #7:

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

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: 3656kb

input:

8

output:

10
1 2 1 4 5 4 7 8 7 
100000 1 1 100000 1 1 100000 1 1 1 

result:

ok correct

Test #9:

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

input:

9

output:

10
1 2 1 4 5 4 7 8 7 
4 1 1 100000 1 1 100000 1 1 1 

result:

ok correct

Test #10:

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

input:

11

output:

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

result:

ok correct

Test #11:

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

input:

23

output:

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

result:

ok correct

Test #12:

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

input:

64

output:

19
1 2 1 4 5 4 7 8 7 10 11 10 13 14 13 16 17 16 
100000 1 1 100000 1 1 100000 1 1 100000 1 1 100000 1 1 100000 1 1 1 

result:

ok correct

Test #13:

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

input:

87

output:

19
1 2 1 4 5 4 7 8 7 10 11 10 13 14 13 16 17 16 
7 1 1 6 1 1 5 1 1 100000 1 1 3 1 1 100000 1 1 1 

result:

ok correct

Test #14:

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

input:

103

output:

19
1 2 1 4 5 4 7 8 7 10 11 10 13 14 13 16 17 16 
7 1 1 6 1 1 5 1 1 100000 1 1 100000 1 1 2 1 1 1 

result:

ok correct

Test #15:

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

input:

128

output:

22
1 2 1 4 5 4 7 8 7 10 11 10 13 14 13 16 17 16 19 20 19 
100000 1 1 100000 1 1 100000 1 1 100000 1 1 100000 1 1 100000 1 1 100000 1 1 1 

result:

ok correct

Test #16:

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

input:

325

output:

25
1 2 1 4 5 4 7 8 7 10 11 10 13 14 13 16 17 16 19 20 19 22 23 22 
9 1 1 100000 1 1 7 1 1 100000 1 1 100000 1 1 100000 1 1 3 1 1 100000 1 1 1 

result:

ok correct

Test #17:

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

input:

567

output:

28
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 
10 1 1 9 1 1 8 1 1 100000 1 1 6 1 1 5 1 1 100000 1 1 100000 1 1 100000 1 1 1 

result:

ok correct

Test #18:

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

input:

9999

output:

40
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 28 31 32 31 34 35 34 37 38 37 
14 1 1 13 1 1 12 1 1 11 1 1 100000 1 1 100000 1 1 100000 1 1 100000 1 1 6 1 1 5 1 1 4 1 1 100000 1 1 100000 1 1 1 

result:

ok correct

Test #19:

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

input:

93256

output:

49
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 28 31 32 31 34 35 34 37 38 37 40 41 40 43 44 43 46 47 46 
100000 1 1 100000 1 1 100000 1 1 14 1 1 100000 1 1 100000 1 1 11 1 1 100000 1 1 100000 1 1 100000 1 1 7 1 1 6 1 1 100000 1 1 4 1 1 3 1 1 100000 1 1 1 

result:

ok correct

Test #20:

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

input:

3532462

output:

64
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 28 31 32 31 34 35 34 37 38 37 40 41 40 43 44 43 46 47 46 49 50 49 52 53 52 55 56 55 58 59 58 61 62 61 
100000 1 1 21 1 1 20 1 1 19 1 1 100000 1 1 17 1 1 100000 1 1 15 1 1 100000 1 1 13 1 1 12 1 1 100000 1 1 100000 1 1 9...

result:

ok correct

Test #21:

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

input:

54389236

output:

76
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 28 31 32 31 34 35 34 37 38 37 40 41 40 43 44 43 46 47 46 49 50 49 52 53 52 55 56 55 58 59 58 61 62 61 64 65 64 67 68 67 70 71 70 73 74 73 
100000 1 1 100000 1 1 24 1 1 100000 1 1 22 1 1 21 1 1 20 1 1 19 1 1 18 1 1 10000...

result:

ok correct

Test #22:

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

input:

93453967

output:

79
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 28 31 32 31 34 35 34 37 38 37 40 41 40 43 44 43 46 47 46 49 50 49 52 53 52 55 56 55 58 59 58 61 62 61 64 65 64 67 68 67 70 71 70 73 74 73 76 77 76 
27 1 1 26 1 1 25 1 1 24 1 1 100000 1 1 100000 1 1 100000 1 1 20 1 1 100...

result:

ok correct

Test #23:

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

input:

1000000000

output:

88
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 28 31 32 31 34 35 34 37 38 37 40 41 40 43 44 43 46 47 46 49 50 49 52 53 52 55 56 55 58 59 58 61 62 61 64 65 64 67 68 67 70 71 70 73 74 73 76 77 76 79 80 79 82 83 82 85 86 85 
100000 1 1 100000 1 1 100000 1 1 100000 1 1 ...

result:

ok correct

Test #24:

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

input:

999999999

output:

88
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 28 31 32 31 34 35 34 37 38 37 40 41 40 43 44 43 46 47 46 49 50 49 52 53 52 55 56 55 58 59 58 61 62 61 64 65 64 67 68 67 70 71 70 73 74 73 76 77 76 79 80 79 82 83 82 85 86 85 
30 1 1 29 1 1 28 1 1 27 1 1 26 1 1 25 1 1 24...

result:

ok correct

Test #25:

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

input:

888888888

output:

88
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 28 31 32 31 34 35 34 37 38 37 40 41 40 43 44 43 46 47 46 49 50 49 52 53 52 55 56 55 58 59 58 61 62 61 64 65 64 67 68 67 70 71 70 73 74 73 76 77 76 79 80 79 82 83 82 85 86 85 
100000 1 1 100000 1 1 100000 1 1 27 1 1 26 1...

result:

ok correct

Test #26:

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

input:

333333334

output:

85
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 28 31 32 31 34 35 34 37 38 37 40 41 40 43 44 43 46 47 46 49 50 49 52 53 52 55 56 55 58 59 58 61 62 61 64 65 64 67 68 67 70 71 70 73 74 73 76 77 76 79 80 79 82 83 82 
100000 1 1 28 1 1 27 1 1 100000 1 1 25 1 1 100000 1 1...

result:

ok correct

Test #27:

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

input:

83495645

output:

79
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 28 31 32 31 34 35 34 37 38 37 40 41 40 43 44 43 46 47 46 49 50 49 52 53 52 55 56 55 58 59 58 61 62 61 64 65 64 67 68 67 70 71 70 73 74 73 76 77 76 
27 1 1 100000 1 1 25 1 1 24 1 1 23 1 1 100000 1 1 21 1 1 20 1 1 100000 ...

result:

ok correct

Test #28:

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

input:

894567865

output:

88
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 28 31 32 31 34 35 34 37 38 37 40 41 40 43 44 43 46 47 46 49 50 49 52 53 52 55 56 55 58 59 58 61 62 61 64 65 64 67 68 67 70 71 70 73 74 73 76 77 76 79 80 79 82 83 82 85 86 85 
30 1 1 100000 1 1 100000 1 1 27 1 1 26 1 1 2...

result:

ok correct

Test #29:

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

input:

88479456

output:

79
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 28 31 32 31 34 35 34 37 38 37 40 41 40 43 44 43 46 47 46 49 50 49 52 53 52 55 56 55 58 59 58 61 62 61 64 65 64 67 68 67 70 71 70 73 74 73 76 77 76 
100000 1 1 100000 1 1 100000 1 1 100000 1 1 100000 1 1 22 1 1 21 1 1 20...

result:

ok correct

Test #30:

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

input:

1000000

output:

58
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 28 31 32 31 34 35 34 37 38 37 40 41 40 43 44 43 46 47 46 49 50 49 52 53 52 55 56 55 
100000 1 1 100000 1 1 100000 1 1 100000 1 1 100000 1 1 100000 1 1 14 1 1 100000 1 1 100000 1 1 11 1 1 100000 1 1 100000 1 1 100000 1 1...

result:

ok correct

Test #31:

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

input:

429085001

output:

85
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 28 31 32 31 34 35 34 37 38 37 40 41 40 43 44 43 46 47 46 49 50 49 52 53 52 55 56 55 58 59 58 61 62 61 64 65 64 67 68 67 70 71 70 73 74 73 76 77 76 79 80 79 82 83 82 
29 1 1 100000 1 1 100000 1 1 26 1 1 100000 1 1 100000...

result:

ok correct

Test #32:

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

input:

882138811

output:

88
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 28 31 32 31 34 35 34 37 38 37 40 41 40 43 44 43 46 47 46 49 50 49 52 53 52 55 56 55 58 59 58 61 62 61 64 65 64 67 68 67 70 71 70 73 74 73 76 77 76 79 80 79 82 83 82 85 86 85 
30 1 1 29 1 1 100000 1 1 27 1 1 26 1 1 25 1 ...

result:

ok correct

Test #33:

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

input:

513157691

output:

85
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 28 31 32 31 34 35 34 37 38 37 40 41 40 43 44 43 46 47 46 49 50 49 52 53 52 55 56 55 58 59 58 61 62 61 64 65 64 67 68 67 70 71 70 73 74 73 76 77 76 79 80 79 82 83 82 
29 1 1 28 1 1 100000 1 1 26 1 1 25 1 1 24 1 1 100000 ...

result:

ok correct

Test #34:

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

input:

813900859

output:

88
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 28 31 32 31 34 35 34 37 38 37 40 41 40 43 44 43 46 47 46 49 50 49 52 53 52 55 56 55 58 59 58 61 62 61 64 65 64 67 68 67 70 71 70 73 74 73 76 77 76 79 80 79 82 83 82 85 86 85 
30 1 1 29 1 1 100000 1 1 27 1 1 26 1 1 25 1 ...

result:

ok correct

Test #35:

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

input:

454848871

output:

85
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 28 31 32 31 34 35 34 37 38 37 40 41 40 43 44 43 46 47 46 49 50 49 52 53 52 55 56 55 58 59 58 61 62 61 64 65 64 67 68 67 70 71 70 73 74 73 76 77 76 79 80 79 82 83 82 
29 1 1 28 1 1 27 1 1 100000 1 1 100000 1 1 24 1 1 23 ...

result:

ok correct

Test #36:

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

input:

151401319

output:

82
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 28 31 32 31 34 35 34 37 38 37 40 41 40 43 44 43 46 47 46 49 50 49 52 53 52 55 56 55 58 59 58 61 62 61 64 65 64 67 68 67 70 71 70 73 74 73 76 77 76 79 80 79 
28 1 1 27 1 1 26 1 1 100000 1 1 100000 1 1 23 1 1 22 1 1 10000...

result:

ok correct

Test #37:

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

input:

280898521

output:

85
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 28 31 32 31 34 35 34 37 38 37 40 41 40 43 44 43 46 47 46 49 50 49 52 53 52 55 56 55 58 59 58 61 62 61 64 65 64 67 68 67 70 71 70 73 74 73 76 77 76 79 80 79 82 83 82 
29 1 1 100000 1 1 100000 1 1 26 1 1 25 1 1 100000 1 1...

result:

ok correct

Test #38:

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

input:

412968047

output:

85
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 28 31 32 31 34 35 34 37 38 37 40 41 40 43 44 43 46 47 46 49 50 49 52 53 52 55 56 55 58 59 58 61 62 61 64 65 64 67 68 67 70 71 70 73 74 73 76 77 76 79 80 79 82 83 82 
29 1 1 28 1 1 27 1 1 26 1 1 100000 1 1 24 1 1 23 1 1 ...

result:

ok correct

Extra Test:

score: 0
Extra Test Passed