QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#449765#8300. Game DesignPetroTarnavskyi#AC ✓0ms3828kbC++201.1kb2024-06-21 16:58:092024-06-21 16:58:09

Judging History

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

  • [2024-06-21 16:58:09]
  • 评测
  • 测评结果:AC
  • 用时:0ms
  • 内存:3828kb
  • [2024-06-21 16:58:09]
  • 提交

answer

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

#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define RFOR(i, a, b) for(int i = (a) - 1; i >= (b); i--)
#define SZ(a) int(a.size())
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair
#define F first
#define S second

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef double db;

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	int w = 1 << 29;
	
	int k;
	cin >> k;
	
	if(k == 1)
	{
		cout << "2\n";
		cout << "1\n";
		cout << "4 7\n";
		return 0;
	}
	
	VI p = {-1};
	VI weigh = {0};
	
	while(k != 1)
	{
		int root = SZ(p) - 1;
		weigh[root] = w + 1 - (k % 2);
		
		int l = SZ(p);
				
		p.PB(root);
		weigh.PB(2);
		
		p.PB(l);
		weigh.PB(1);
		p.PB(l);
		weigh.PB(1);
		
		
		p.PB(root);
		weigh.PB(0);
		w -= 2;
		k /= 2;
	}
	weigh.back() = w;
	
	cout << SZ(p) << "\n";
	FOR(i, 1, SZ(p))
	{
		if(i != 1)
			cout << " ";
		cout << p[i] + 1;
	}
	cout << "\n";
	FOR(i, 0, SZ(p))
	{
		if(i)
			cout << " ";
		cout << weigh[i];
	}
	cout << "\n";
	
	
	return 0;
}

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2

output:

5
1 2 2 1
536870913 2 1 1 536870910

result:

ok correct

Test #2:

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

input:

1

output:

2
1
4 7

result:

ok correct

Test #3:

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

input:

3

output:

5
1 2 2 1
536870912 2 1 1 536870910

result:

ok correct

Test #4:

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

input:

4

output:

9
1 2 2 1 5 6 6 5
536870913 2 1 1 536870911 2 1 1 536870908

result:

ok correct

Test #5:

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

input:

5

output:

9
1 2 2 1 5 6 6 5
536870912 2 1 1 536870911 2 1 1 536870908

result:

ok correct

Test #6:

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

input:

6

output:

9
1 2 2 1 5 6 6 5
536870913 2 1 1 536870910 2 1 1 536870908

result:

ok correct

Test #7:

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

input:

7

output:

9
1 2 2 1 5 6 6 5
536870912 2 1 1 536870910 2 1 1 536870908

result:

ok correct

Test #8:

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

input:

8

output:

13
1 2 2 1 5 6 6 5 9 10 10 9
536870913 2 1 1 536870911 2 1 1 536870909 2 1 1 536870906

result:

ok correct

Test #9:

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

input:

9

output:

13
1 2 2 1 5 6 6 5 9 10 10 9
536870912 2 1 1 536870911 2 1 1 536870909 2 1 1 536870906

result:

ok correct

Test #10:

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

input:

11

output:

13
1 2 2 1 5 6 6 5 9 10 10 9
536870912 2 1 1 536870910 2 1 1 536870909 2 1 1 536870906

result:

ok correct

Test #11:

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

input:

23

output:

17
1 2 2 1 5 6 6 5 9 10 10 9 13 14 14 13
536870912 2 1 1 536870910 2 1 1 536870908 2 1 1 536870907 2 1 1 536870904

result:

ok correct

Test #12:

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

input:

64

output:

25
1 2 2 1 5 6 6 5 9 10 10 9 13 14 14 13 17 18 18 17 21 22 22 21
536870913 2 1 1 536870911 2 1 1 536870909 2 1 1 536870907 2 1 1 536870905 2 1 1 536870903 2 1 1 536870900

result:

ok correct

Test #13:

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

input:

87

output:

25
1 2 2 1 5 6 6 5 9 10 10 9 13 14 14 13 17 18 18 17 21 22 22 21
536870912 2 1 1 536870910 2 1 1 536870908 2 1 1 536870907 2 1 1 536870904 2 1 1 536870903 2 1 1 536870900

result:

ok correct

Test #14:

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

input:

103

output:

25
1 2 2 1 5 6 6 5 9 10 10 9 13 14 14 13 17 18 18 17 21 22 22 21
536870912 2 1 1 536870910 2 1 1 536870908 2 1 1 536870907 2 1 1 536870905 2 1 1 536870902 2 1 1 536870900

result:

ok correct

Test #15:

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

input:

128

output:

29
1 2 2 1 5 6 6 5 9 10 10 9 13 14 14 13 17 18 18 17 21 22 22 21 25 26 26 25
536870913 2 1 1 536870911 2 1 1 536870909 2 1 1 536870907 2 1 1 536870905 2 1 1 536870903 2 1 1 536870901 2 1 1 536870898

result:

ok correct

Test #16:

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

input:

325

output:

33
1 2 2 1 5 6 6 5 9 10 10 9 13 14 14 13 17 18 18 17 21 22 22 21 25 26 26 25 29 30 30 29
536870912 2 1 1 536870911 2 1 1 536870908 2 1 1 536870907 2 1 1 536870905 2 1 1 536870903 2 1 1 536870900 2 1 1 536870899 2 1 1 536870896

result:

ok correct

Test #17:

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

input:

567

output:

37
1 2 2 1 5 6 6 5 9 10 10 9 13 14 14 13 17 18 18 17 21 22 22 21 25 26 26 25 29 30 30 29 33 34 34 33
536870912 2 1 1 536870910 2 1 1 536870908 2 1 1 536870907 2 1 1 536870904 2 1 1 536870902 2 1 1 536870901 2 1 1 536870899 2 1 1 536870897 2 1 1 536870894

result:

ok correct

Test #18:

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

input:

9999

output:

53
1 2 2 1 5 6 6 5 9 10 10 9 13 14 14 13 17 18 18 17 21 22 22 21 25 26 26 25 29 30 30 29 33 34 34 33 37 38 38 37 41 42 42 41 45 46 46 45 49 50 50 49
536870912 2 1 1 536870910 2 1 1 536870908 2 1 1 536870906 2 1 1 536870905 2 1 1 536870903 2 1 1 536870901 2 1 1 536870899 2 1 1 536870896 2 1 1 5368708...

result:

ok correct

Test #19:

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

input:

93256

output:

65
1 2 2 1 5 6 6 5 9 10 10 9 13 14 14 13 17 18 18 17 21 22 22 21 25 26 26 25 29 30 30 29 33 34 34 33 37 38 38 37 41 42 42 41 45 46 46 45 49 50 50 49 53 54 54 53 57 58 58 57 61 62 62 61
536870913 2 1 1 536870911 2 1 1 536870909 2 1 1 536870906 2 1 1 536870905 2 1 1 536870903 2 1 1 536870900 2 1 1 536...

result:

ok correct

Test #20:

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

input:

3532462

output:

85
1 2 2 1 5 6 6 5 9 10 10 9 13 14 14 13 17 18 18 17 21 22 22 21 25 26 26 25 29 30 30 29 33 34 34 33 37 38 38 37 41 42 42 41 45 46 46 45 49 50 50 49 53 54 54 53 57 58 58 57 61 62 62 61 65 66 66 65 69 70 70 69 73 74 74 73 77 78 78 77 81 82 82 81
536870913 2 1 1 536870910 2 1 1 536870908 2 1 1 5368709...

result:

ok correct

Test #21:

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

input:

54389236

output:

101
1 2 2 1 5 6 6 5 9 10 10 9 13 14 14 13 17 18 18 17 21 22 22 21 25 26 26 25 29 30 30 29 33 34 34 33 37 38 38 37 41 42 42 41 45 46 46 45 49 50 50 49 53 54 54 53 57 58 58 57 61 62 62 61 65 66 66 65 69 70 70 69 73 74 74 73 77 78 78 77 81 82 82 81 85 86 86 85 89 90 90 89 93 94 94 93 97 98 98 97
536870...

result:

ok correct

Test #22:

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

input:

93453967

output:

105
1 2 2 1 5 6 6 5 9 10 10 9 13 14 14 13 17 18 18 17 21 22 22 21 25 26 26 25 29 30 30 29 33 34 34 33 37 38 38 37 41 42 42 41 45 46 46 45 49 50 50 49 53 54 54 53 57 58 58 57 61 62 62 61 65 66 66 65 69 70 70 69 73 74 74 73 77 78 78 77 81 82 82 81 85 86 86 85 89 90 90 89 93 94 94 93 97 98 98 97 101 10...

result:

ok correct

Test #23:

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

input:

1000000000

output:

117
1 2 2 1 5 6 6 5 9 10 10 9 13 14 14 13 17 18 18 17 21 22 22 21 25 26 26 25 29 30 30 29 33 34 34 33 37 38 38 37 41 42 42 41 45 46 46 45 49 50 50 49 53 54 54 53 57 58 58 57 61 62 62 61 65 66 66 65 69 70 70 69 73 74 74 73 77 78 78 77 81 82 82 81 85 86 86 85 89 90 90 89 93 94 94 93 97 98 98 97 101 10...

result:

ok correct

Test #24:

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

input:

999999999

output:

117
1 2 2 1 5 6 6 5 9 10 10 9 13 14 14 13 17 18 18 17 21 22 22 21 25 26 26 25 29 30 30 29 33 34 34 33 37 38 38 37 41 42 42 41 45 46 46 45 49 50 50 49 53 54 54 53 57 58 58 57 61 62 62 61 65 66 66 65 69 70 70 69 73 74 74 73 77 78 78 77 81 82 82 81 85 86 86 85 89 90 90 89 93 94 94 93 97 98 98 97 101 10...

result:

ok correct

Test #25:

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

input:

888888888

output:

117
1 2 2 1 5 6 6 5 9 10 10 9 13 14 14 13 17 18 18 17 21 22 22 21 25 26 26 25 29 30 30 29 33 34 34 33 37 38 38 37 41 42 42 41 45 46 46 45 49 50 50 49 53 54 54 53 57 58 58 57 61 62 62 61 65 66 66 65 69 70 70 69 73 74 74 73 77 78 78 77 81 82 82 81 85 86 86 85 89 90 90 89 93 94 94 93 97 98 98 97 101 10...

result:

ok correct

Test #26:

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

input:

333333334

output:

113
1 2 2 1 5 6 6 5 9 10 10 9 13 14 14 13 17 18 18 17 21 22 22 21 25 26 26 25 29 30 30 29 33 34 34 33 37 38 38 37 41 42 42 41 45 46 46 45 49 50 50 49 53 54 54 53 57 58 58 57 61 62 62 61 65 66 66 65 69 70 70 69 73 74 74 73 77 78 78 77 81 82 82 81 85 86 86 85 89 90 90 89 93 94 94 93 97 98 98 97 101 10...

result:

ok correct

Test #27:

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

input:

83495645

output:

105
1 2 2 1 5 6 6 5 9 10 10 9 13 14 14 13 17 18 18 17 21 22 22 21 25 26 26 25 29 30 30 29 33 34 34 33 37 38 38 37 41 42 42 41 45 46 46 45 49 50 50 49 53 54 54 53 57 58 58 57 61 62 62 61 65 66 66 65 69 70 70 69 73 74 74 73 77 78 78 77 81 82 82 81 85 86 86 85 89 90 90 89 93 94 94 93 97 98 98 97 101 10...

result:

ok correct

Test #28:

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

input:

894567865

output:

117
1 2 2 1 5 6 6 5 9 10 10 9 13 14 14 13 17 18 18 17 21 22 22 21 25 26 26 25 29 30 30 29 33 34 34 33 37 38 38 37 41 42 42 41 45 46 46 45 49 50 50 49 53 54 54 53 57 58 58 57 61 62 62 61 65 66 66 65 69 70 70 69 73 74 74 73 77 78 78 77 81 82 82 81 85 86 86 85 89 90 90 89 93 94 94 93 97 98 98 97 101 10...

result:

ok correct

Test #29:

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

input:

88479456

output:

105
1 2 2 1 5 6 6 5 9 10 10 9 13 14 14 13 17 18 18 17 21 22 22 21 25 26 26 25 29 30 30 29 33 34 34 33 37 38 38 37 41 42 42 41 45 46 46 45 49 50 50 49 53 54 54 53 57 58 58 57 61 62 62 61 65 66 66 65 69 70 70 69 73 74 74 73 77 78 78 77 81 82 82 81 85 86 86 85 89 90 90 89 93 94 94 93 97 98 98 97 101 10...

result:

ok correct

Test #30:

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

input:

1000000

output:

77
1 2 2 1 5 6 6 5 9 10 10 9 13 14 14 13 17 18 18 17 21 22 22 21 25 26 26 25 29 30 30 29 33 34 34 33 37 38 38 37 41 42 42 41 45 46 46 45 49 50 50 49 53 54 54 53 57 58 58 57 61 62 62 61 65 66 66 65 69 70 70 69 73 74 74 73
536870913 2 1 1 536870911 2 1 1 536870909 2 1 1 536870907 2 1 1 536870905 2 1 1...

result:

ok correct

Test #31:

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

input:

429085001

output:

113
1 2 2 1 5 6 6 5 9 10 10 9 13 14 14 13 17 18 18 17 21 22 22 21 25 26 26 25 29 30 30 29 33 34 34 33 37 38 38 37 41 42 42 41 45 46 46 45 49 50 50 49 53 54 54 53 57 58 58 57 61 62 62 61 65 66 66 65 69 70 70 69 73 74 74 73 77 78 78 77 81 82 82 81 85 86 86 85 89 90 90 89 93 94 94 93 97 98 98 97 101 10...

result:

ok correct

Test #32:

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

input:

882138811

output:

117
1 2 2 1 5 6 6 5 9 10 10 9 13 14 14 13 17 18 18 17 21 22 22 21 25 26 26 25 29 30 30 29 33 34 34 33 37 38 38 37 41 42 42 41 45 46 46 45 49 50 50 49 53 54 54 53 57 58 58 57 61 62 62 61 65 66 66 65 69 70 70 69 73 74 74 73 77 78 78 77 81 82 82 81 85 86 86 85 89 90 90 89 93 94 94 93 97 98 98 97 101 10...

result:

ok correct

Test #33:

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

input:

513157691

output:

113
1 2 2 1 5 6 6 5 9 10 10 9 13 14 14 13 17 18 18 17 21 22 22 21 25 26 26 25 29 30 30 29 33 34 34 33 37 38 38 37 41 42 42 41 45 46 46 45 49 50 50 49 53 54 54 53 57 58 58 57 61 62 62 61 65 66 66 65 69 70 70 69 73 74 74 73 77 78 78 77 81 82 82 81 85 86 86 85 89 90 90 89 93 94 94 93 97 98 98 97 101 10...

result:

ok correct

Test #34:

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

input:

813900859

output:

117
1 2 2 1 5 6 6 5 9 10 10 9 13 14 14 13 17 18 18 17 21 22 22 21 25 26 26 25 29 30 30 29 33 34 34 33 37 38 38 37 41 42 42 41 45 46 46 45 49 50 50 49 53 54 54 53 57 58 58 57 61 62 62 61 65 66 66 65 69 70 70 69 73 74 74 73 77 78 78 77 81 82 82 81 85 86 86 85 89 90 90 89 93 94 94 93 97 98 98 97 101 10...

result:

ok correct

Test #35:

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

input:

454848871

output:

113
1 2 2 1 5 6 6 5 9 10 10 9 13 14 14 13 17 18 18 17 21 22 22 21 25 26 26 25 29 30 30 29 33 34 34 33 37 38 38 37 41 42 42 41 45 46 46 45 49 50 50 49 53 54 54 53 57 58 58 57 61 62 62 61 65 66 66 65 69 70 70 69 73 74 74 73 77 78 78 77 81 82 82 81 85 86 86 85 89 90 90 89 93 94 94 93 97 98 98 97 101 10...

result:

ok correct

Test #36:

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

input:

151401319

output:

109
1 2 2 1 5 6 6 5 9 10 10 9 13 14 14 13 17 18 18 17 21 22 22 21 25 26 26 25 29 30 30 29 33 34 34 33 37 38 38 37 41 42 42 41 45 46 46 45 49 50 50 49 53 54 54 53 57 58 58 57 61 62 62 61 65 66 66 65 69 70 70 69 73 74 74 73 77 78 78 77 81 82 82 81 85 86 86 85 89 90 90 89 93 94 94 93 97 98 98 97 101 10...

result:

ok correct

Test #37:

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

input:

280898521

output:

113
1 2 2 1 5 6 6 5 9 10 10 9 13 14 14 13 17 18 18 17 21 22 22 21 25 26 26 25 29 30 30 29 33 34 34 33 37 38 38 37 41 42 42 41 45 46 46 45 49 50 50 49 53 54 54 53 57 58 58 57 61 62 62 61 65 66 66 65 69 70 70 69 73 74 74 73 77 78 78 77 81 82 82 81 85 86 86 85 89 90 90 89 93 94 94 93 97 98 98 97 101 10...

result:

ok correct

Test #38:

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

input:

412968047

output:

113
1 2 2 1 5 6 6 5 9 10 10 9 13 14 14 13 17 18 18 17 21 22 22 21 25 26 26 25 29 30 30 29 33 34 34 33 37 38 38 37 41 42 42 41 45 46 46 45 49 50 50 49 53 54 54 53 57 58 58 57 61 62 62 61 65 66 66 65 69 70 70 69 73 74 74 73 77 78 78 77 81 82 82 81 85 86 86 85 89 90 90 89 93 94 94 93 97 98 98 97 101 10...

result:

ok correct

Extra Test:

score: 0
Extra Test Passed