QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#590716#7665. BaggageKevin5307AC ✓1ms3752kbC++201.3kb2024-09-26 10:28:482024-09-26 10:28:49

Judging History

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

  • [2024-09-26 10:28:49]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3752kb
  • [2024-09-26 10:28:48]
  • 提交

answer

//Author: Kevin
#include<bits/stdc++.h>
//#pragma GCC optimize("O2")
using namespace std;
#define ll long long
#define ull unsigned ll
#define pb emplace_back
#define mp make_pair
#define ALL(x) (x).begin(),(x).end()
#define rALL(x) (x).rbegin(),(x).rend()
#define srt(x) sort(ALL(x))
#define rev(x) reverse(ALL(x))
#define rsrt(x) sort(rALL(x))
#define sz(x) (int)(x.size())
#define inf 0x3f3f3f3f
#define pii pair<int,int>
#define lb(v,x) (int)(lower_bound(ALL(v),x)-v.begin())
#define ub(v,x) (int)(upper_bound(ALL(v),x)-v.begin())
#define uni(v) v.resize(unique(ALL(v))-v.begin())
#define longer __int128_t
void die(string S){puts(S.c_str());exit(0);}
vector<int> solve(int n)
{
	if(n==4) return {6,3,0,7};
	if(n==5) return {8,3,6,0,9};
	if(n==6) return {10,7,2,6,0,11};
	if(n==7) return {8,5,12,3,9,0,13};
	vector<int> ret=solve(n-4);
	for(auto &x:ret) x+=4;
	ret.insert(ret.begin(),3);
	ret.insert(ret.begin(),n*2-2);
	ret.pb(0);
	ret.pb(n*2-1);
	return ret;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int n;
	cin>>n;
	if(n==3)
	{
		cout<<"2 to -1"<<endl;
		cout<<"5 to 2"<<endl;
		cout<<"3 to -3"<<endl;
		return 0;
	}
	vector<int> vec=solve(n);
	vec.insert(vec.begin(),-1);
	for(int i=1;i<sz(vec);i++)
		cout<<vec[i]<<" to "<<vec[i-1]<<endl;
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5

output:

8 to -1
3 to 8
6 to 3
0 to 6
9 to 0

result:

ok 5 step(s) in total

Test #2:

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

input:

8

output:

14 to -1
3 to 14
10 to 3
7 to 10
4 to 7
11 to 4
0 to 11
15 to 0

result:

ok 8 step(s) in total

Test #3:

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

input:

10

output:

18 to -1
3 to 18
14 to 3
11 to 14
6 to 11
10 to 6
4 to 10
15 to 4
0 to 15
19 to 0

result:

ok 10 step(s) in total

Test #4:

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

input:

100

output:

198 to -1
3 to 198
194 to 3
7 to 194
190 to 7
11 to 190
186 to 11
15 to 186
182 to 15
19 to 182
178 to 19
23 to 178
174 to 23
27 to 174
170 to 27
31 to 170
166 to 31
35 to 166
162 to 35
39 to 162
158 to 39
43 to 158
154 to 43
47 to 154
150 to 47
51 to 150
146 to 51
55 to 146
142 to 55
59 to 142
138 ...

result:

ok 100 step(s) in total

Test #5:

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

input:

11

output:

20 to -1
3 to 20
12 to 3
9 to 12
16 to 9
7 to 16
13 to 7
4 to 13
17 to 4
0 to 17
21 to 0

result:

ok 11 step(s) in total

Test #6:

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

input:

12

output:

22 to -1
3 to 22
18 to 3
7 to 18
14 to 7
11 to 14
8 to 11
15 to 8
4 to 15
19 to 4
0 to 19
23 to 0

result:

ok 12 step(s) in total

Test #7:

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

input:

13

output:

24 to -1
3 to 24
20 to 3
7 to 20
16 to 7
11 to 16
14 to 11
8 to 14
17 to 8
4 to 17
21 to 4
0 to 21
25 to 0

result:

ok 13 step(s) in total

Test #8:

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

input:

16

output:

30 to -1
3 to 30
26 to 3
7 to 26
22 to 7
11 to 22
18 to 11
15 to 18
12 to 15
19 to 12
8 to 19
23 to 8
4 to 23
27 to 4
0 to 27
31 to 0

result:

ok 16 step(s) in total

Test #9:

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

input:

17

output:

32 to -1
3 to 32
28 to 3
7 to 28
24 to 7
11 to 24
20 to 11
15 to 20
18 to 15
12 to 18
21 to 12
8 to 21
25 to 8
4 to 25
29 to 4
0 to 29
33 to 0

result:

ok 17 step(s) in total

Test #10:

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

input:

19

output:

36 to -1
3 to 36
32 to 3
7 to 32
28 to 7
11 to 28
20 to 11
17 to 20
24 to 17
15 to 24
21 to 15
12 to 21
25 to 12
8 to 25
29 to 8
4 to 29
33 to 4
0 to 33
37 to 0

result:

ok 19 step(s) in total

Test #11:

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

input:

23

output:

44 to -1
3 to 44
40 to 3
7 to 40
36 to 7
11 to 36
32 to 11
15 to 32
24 to 15
21 to 24
28 to 21
19 to 28
25 to 19
16 to 25
29 to 16
12 to 29
33 to 12
8 to 33
37 to 8
4 to 37
41 to 4
0 to 41
45 to 0

result:

ok 23 step(s) in total

Test #12:

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

input:

25

output:

48 to -1
3 to 48
44 to 3
7 to 44
40 to 7
11 to 40
36 to 11
15 to 36
32 to 15
19 to 32
28 to 19
23 to 28
26 to 23
20 to 26
29 to 20
16 to 29
33 to 16
12 to 33
37 to 12
8 to 37
41 to 8
4 to 41
45 to 4
0 to 45
49 to 0

result:

ok 25 step(s) in total

Test #13:

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

input:

29

output:

56 to -1
3 to 56
52 to 3
7 to 52
48 to 7
11 to 48
44 to 11
15 to 44
40 to 15
19 to 40
36 to 19
23 to 36
32 to 23
27 to 32
30 to 27
24 to 30
33 to 24
20 to 33
37 to 20
16 to 37
41 to 16
12 to 41
45 to 12
8 to 45
49 to 8
4 to 49
53 to 4
0 to 53
57 to 0

result:

ok 29 step(s) in total

Test #14:

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

input:

3

output:

2 to -1
5 to 2
3 to -3

result:

ok 3 step(s) in total

Test #15:

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

input:

31

output:

60 to -1
3 to 60
56 to 3
7 to 56
52 to 7
11 to 52
48 to 11
15 to 48
44 to 15
19 to 44
40 to 19
23 to 40
32 to 23
29 to 32
36 to 29
27 to 36
33 to 27
24 to 33
37 to 24
20 to 37
41 to 20
16 to 41
45 to 16
12 to 45
49 to 12
8 to 49
53 to 8
4 to 53
57 to 4
0 to 57
61 to 0

result:

ok 31 step(s) in total

Test #16:

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

input:

36

output:

70 to -1
3 to 70
66 to 3
7 to 66
62 to 7
11 to 62
58 to 11
15 to 58
54 to 15
19 to 54
50 to 19
23 to 50
46 to 23
27 to 46
42 to 27
31 to 42
38 to 31
35 to 38
32 to 35
39 to 32
28 to 39
43 to 28
24 to 43
47 to 24
20 to 47
51 to 20
16 to 51
55 to 16
12 to 55
59 to 12
8 to 59
63 to 8
4 to 63
67 to 4
0 ...

result:

ok 36 step(s) in total

Test #17:

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

input:

37

output:

72 to -1
3 to 72
68 to 3
7 to 68
64 to 7
11 to 64
60 to 11
15 to 60
56 to 15
19 to 56
52 to 19
23 to 52
48 to 23
27 to 48
44 to 27
31 to 44
40 to 31
35 to 40
38 to 35
32 to 38
41 to 32
28 to 41
45 to 28
24 to 45
49 to 24
20 to 49
53 to 20
16 to 53
57 to 16
12 to 57
61 to 12
8 to 61
65 to 8
4 to 65
6...

result:

ok 37 step(s) in total

Test #18:

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

input:

4

output:

6 to -1
3 to 6
0 to 3
7 to 0

result:

ok 4 step(s) in total

Test #19:

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

input:

41

output:

80 to -1
3 to 80
76 to 3
7 to 76
72 to 7
11 to 72
68 to 11
15 to 68
64 to 15
19 to 64
60 to 19
23 to 60
56 to 23
27 to 56
52 to 27
31 to 52
48 to 31
35 to 48
44 to 35
39 to 44
42 to 39
36 to 42
45 to 36
32 to 45
49 to 32
28 to 49
53 to 28
24 to 53
57 to 24
20 to 57
61 to 20
16 to 61
65 to 16
12 to 6...

result:

ok 41 step(s) in total

Test #20:

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

input:

43

output:

84 to -1
3 to 84
80 to 3
7 to 80
76 to 7
11 to 76
72 to 11
15 to 72
68 to 15
19 to 68
64 to 19
23 to 64
60 to 23
27 to 60
56 to 27
31 to 56
52 to 31
35 to 52
44 to 35
41 to 44
48 to 41
39 to 48
45 to 39
36 to 45
49 to 36
32 to 49
53 to 32
28 to 53
57 to 28
24 to 57
61 to 24
20 to 61
65 to 20
16 to 6...

result:

ok 43 step(s) in total

Test #21:

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

input:

47

output:

92 to -1
3 to 92
88 to 3
7 to 88
84 to 7
11 to 84
80 to 11
15 to 80
76 to 15
19 to 76
72 to 19
23 to 72
68 to 23
27 to 68
64 to 27
31 to 64
60 to 31
35 to 60
56 to 35
39 to 56
48 to 39
45 to 48
52 to 45
43 to 52
49 to 43
40 to 49
53 to 40
36 to 53
57 to 36
32 to 57
61 to 32
28 to 61
65 to 28
24 to 6...

result:

ok 47 step(s) in total

Test #22:

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

input:

49

output:

96 to -1
3 to 96
92 to 3
7 to 92
88 to 7
11 to 88
84 to 11
15 to 84
80 to 15
19 to 80
76 to 19
23 to 76
72 to 23
27 to 72
68 to 27
31 to 68
64 to 31
35 to 64
60 to 35
39 to 60
56 to 39
43 to 56
52 to 43
47 to 52
50 to 47
44 to 50
53 to 44
40 to 53
57 to 40
36 to 57
61 to 36
32 to 61
65 to 32
28 to 6...

result:

ok 49 step(s) in total

Test #23:

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

input:

5

output:

8 to -1
3 to 8
6 to 3
0 to 6
9 to 0

result:

ok 5 step(s) in total

Test #24:

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

input:

51

output:

100 to -1
3 to 100
96 to 3
7 to 96
92 to 7
11 to 92
88 to 11
15 to 88
84 to 15
19 to 84
80 to 19
23 to 80
76 to 23
27 to 76
72 to 27
31 to 72
68 to 31
35 to 68
64 to 35
39 to 64
60 to 39
43 to 60
52 to 43
49 to 52
56 to 49
47 to 56
53 to 47
44 to 53
57 to 44
40 to 57
61 to 40
36 to 61
65 to 36
32 to...

result:

ok 51 step(s) in total

Test #25:

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

input:

53

output:

104 to -1
3 to 104
100 to 3
7 to 100
96 to 7
11 to 96
92 to 11
15 to 92
88 to 15
19 to 88
84 to 19
23 to 84
80 to 23
27 to 80
76 to 27
31 to 76
72 to 31
35 to 72
68 to 35
39 to 68
64 to 39
43 to 64
60 to 43
47 to 60
56 to 47
51 to 56
54 to 51
48 to 54
57 to 48
44 to 57
61 to 44
40 to 61
65 to 40
36 ...

result:

ok 53 step(s) in total

Test #26:

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

input:

59

output:

116 to -1
3 to 116
112 to 3
7 to 112
108 to 7
11 to 108
104 to 11
15 to 104
100 to 15
19 to 100
96 to 19
23 to 96
92 to 23
27 to 92
88 to 27
31 to 88
84 to 31
35 to 84
80 to 35
39 to 80
76 to 39
43 to 76
72 to 43
47 to 72
68 to 47
51 to 68
60 to 51
57 to 60
64 to 57
55 to 64
61 to 55
52 to 61
65 to ...

result:

ok 59 step(s) in total

Test #27:

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

input:

6

output:

10 to -1
7 to 10
2 to 7
6 to 2
0 to 6
11 to 0

result:

ok 6 step(s) in total

Test #28:

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

input:

61

output:

120 to -1
3 to 120
116 to 3
7 to 116
112 to 7
11 to 112
108 to 11
15 to 108
104 to 15
19 to 104
100 to 19
23 to 100
96 to 23
27 to 96
92 to 27
31 to 92
88 to 31
35 to 88
84 to 35
39 to 84
80 to 39
43 to 80
76 to 43
47 to 76
72 to 47
51 to 72
68 to 51
55 to 68
64 to 55
59 to 64
62 to 59
56 to 62
65 t...

result:

ok 61 step(s) in total

Test #29:

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

input:

64

output:

126 to -1
3 to 126
122 to 3
7 to 122
118 to 7
11 to 118
114 to 11
15 to 114
110 to 15
19 to 110
106 to 19
23 to 106
102 to 23
27 to 102
98 to 27
31 to 98
94 to 31
35 to 94
90 to 35
39 to 90
86 to 39
43 to 86
82 to 43
47 to 82
78 to 47
51 to 78
74 to 51
55 to 74
70 to 55
59 to 70
66 to 59
63 to 66
60...

result:

ok 64 step(s) in total

Test #30:

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

input:

67

output:

132 to -1
3 to 132
128 to 3
7 to 128
124 to 7
11 to 124
120 to 11
15 to 120
116 to 15
19 to 116
112 to 19
23 to 112
108 to 23
27 to 108
104 to 27
31 to 104
100 to 31
35 to 100
96 to 35
39 to 96
92 to 39
43 to 92
88 to 43
47 to 88
84 to 47
51 to 84
80 to 51
55 to 80
76 to 55
59 to 76
68 to 59
65 to 6...

result:

ok 67 step(s) in total

Test #31:

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

input:

7

output:

8 to -1
5 to 8
12 to 5
3 to 12
9 to 3
0 to 9
13 to 0

result:

ok 7 step(s) in total

Test #32:

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

input:

71

output:

140 to -1
3 to 140
136 to 3
7 to 136
132 to 7
11 to 132
128 to 11
15 to 128
124 to 15
19 to 124
120 to 19
23 to 120
116 to 23
27 to 116
112 to 27
31 to 112
108 to 31
35 to 108
104 to 35
39 to 104
100 to 39
43 to 100
96 to 43
47 to 96
92 to 47
51 to 92
88 to 51
55 to 88
84 to 55
59 to 84
80 to 59
63 ...

result:

ok 71 step(s) in total

Test #33:

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

input:

73

output:

144 to -1
3 to 144
140 to 3
7 to 140
136 to 7
11 to 136
132 to 11
15 to 132
128 to 15
19 to 128
124 to 19
23 to 124
120 to 23
27 to 120
116 to 27
31 to 116
112 to 31
35 to 112
108 to 35
39 to 108
104 to 39
43 to 104
100 to 43
47 to 100
96 to 47
51 to 96
92 to 51
55 to 92
88 to 55
59 to 88
84 to 59
6...

result:

ok 73 step(s) in total

Test #34:

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

input:

79

output:

156 to -1
3 to 156
152 to 3
7 to 152
148 to 7
11 to 148
144 to 11
15 to 144
140 to 15
19 to 140
136 to 19
23 to 136
132 to 23
27 to 132
128 to 27
31 to 128
124 to 31
35 to 124
120 to 35
39 to 120
116 to 39
43 to 116
112 to 43
47 to 112
108 to 47
51 to 108
104 to 51
55 to 104
100 to 55
59 to 100
96 t...

result:

ok 79 step(s) in total

Test #35:

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

input:

81

output:

160 to -1
3 to 160
156 to 3
7 to 156
152 to 7
11 to 152
148 to 11
15 to 148
144 to 15
19 to 144
140 to 19
23 to 140
136 to 23
27 to 136
132 to 27
31 to 132
128 to 31
35 to 128
124 to 35
39 to 124
120 to 39
43 to 120
116 to 43
47 to 116
112 to 47
51 to 112
108 to 51
55 to 108
104 to 55
59 to 104
100 ...

result:

ok 81 step(s) in total

Test #36:

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

input:

83

output:

164 to -1
3 to 164
160 to 3
7 to 160
156 to 7
11 to 156
152 to 11
15 to 152
148 to 15
19 to 148
144 to 19
23 to 144
140 to 23
27 to 140
136 to 27
31 to 136
132 to 31
35 to 132
128 to 35
39 to 128
124 to 39
43 to 124
120 to 43
47 to 120
116 to 47
51 to 116
112 to 51
55 to 112
108 to 55
59 to 108
104 ...

result:

ok 83 step(s) in total

Test #37:

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

input:

89

output:

176 to -1
3 to 176
172 to 3
7 to 172
168 to 7
11 to 168
164 to 11
15 to 164
160 to 15
19 to 160
156 to 19
23 to 156
152 to 23
27 to 152
148 to 27
31 to 148
144 to 31
35 to 144
140 to 35
39 to 140
136 to 39
43 to 136
132 to 43
47 to 132
128 to 47
51 to 128
124 to 51
55 to 124
120 to 55
59 to 120
116 ...

result:

ok 89 step(s) in total

Test #38:

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

input:

9

output:

16 to -1
3 to 16
12 to 3
7 to 12
10 to 7
4 to 10
13 to 4
0 to 13
17 to 0

result:

ok 9 step(s) in total

Test #39:

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

input:

95

output:

188 to -1
3 to 188
184 to 3
7 to 184
180 to 7
11 to 180
176 to 11
15 to 176
172 to 15
19 to 172
168 to 19
23 to 168
164 to 23
27 to 164
160 to 27
31 to 160
156 to 31
35 to 156
152 to 35
39 to 152
148 to 39
43 to 148
144 to 43
47 to 144
140 to 47
51 to 140
136 to 51
55 to 136
132 to 55
59 to 132
128 ...

result:

ok 95 step(s) in total

Test #40:

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

input:

97

output:

192 to -1
3 to 192
188 to 3
7 to 188
184 to 7
11 to 184
180 to 11
15 to 180
176 to 15
19 to 176
172 to 19
23 to 172
168 to 23
27 to 168
164 to 27
31 to 164
160 to 31
35 to 160
156 to 35
39 to 156
152 to 39
43 to 152
148 to 43
47 to 148
144 to 47
51 to 144
140 to 51
55 to 140
136 to 55
59 to 136
132 ...

result:

ok 97 step(s) in total