QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#798351#408. Dungeon 2dieselhuang56 12ms4980kbC++142.1kb2024-12-04 12:39:312024-12-04 12:39:33

Judging History

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

  • [2024-12-04 12:39:33]
  • 评测
  • 测评结果:56
  • 用时:12ms
  • 内存:4980kb
  • [2024-12-04 12:39:31]
  • 提交

answer

#include "dungeon2.h"
#include <bits/stdc++.h>
using namespace std;
namespace my_code{
	int n = 0, d[210], e[210][210], dep[210], fa[210][210], dis[210][210], ans[210];
	int bk[210][210];
	int dfs1(int x, int fa0){
		int u = ++n, i, j, v;
		dep[u] = x; fa[u][1] = fa0;
		for(i = 2; fa[u][i - 1] > 1; i++) fa[u][i] = fa[fa[u][i - 1]][1];
		d[u] = NumberOfRoads();
		for(i = 1; i <= d[u]; i++){
			if(bk[u][i] < 0) continue;
			Move(i, 3);
			j = LastRoad();
			if(Color() == 1){
				e[u][i] = v = dfs1(x + 1, u);
				bk[u][i] = 1; bk[v][j] = -1;
				Move(j, 2);
			}else if(Color() == 3){
				e[u][i] = 0; bk[u][i] = 2;
				Move(j, 3);
			}else{
				bk[u][i] = -2;
				Move(j, 2);
			}
		}
		return u;
	}
	void dfs2(int u, int x){
		int i, j, w = dep[u] % (x * 3) / x + 1;
//		printf("%d %d %d\n", u, x, w);
		for(i = 1; i <= d[u]; i++){
			if(bk[u][i] < 0) continue;
			Move(i, w); j = LastRoad();
			if(bk[u][i] == 1){
				dfs2(e[u][i], x);
			}else{
				e[u][i] += (Color() - 1) * x;
			}
			Move(j, Color());
		}
	}
	void Inspect(int R){
		memset(bk, 0, sizeof(bk));
		int i, j, p;
		dfs1(0, 1);
//		for(i = 1; i <= n; i++){
//			printf("%d %d %d %d\n", i, d[i], dep[i], fa[i][1]);
//			for(j = 1; j <= d[i]; j++) printf(" (%d,%d,%d)", j, e[i][j], (int)bk[i][j]);
//			printf("\n");
//		}
		for(i = 1, j = 1; i <= 5; i++, j *= 3){
			dfs2(1, j);
		}
		for(i = 1; i <= n; i++){
			for(j = 1; j <= n; j++) dis[i][j] = R;
		}
		for(i = 1; i <= n; i++){
			for(j = 1; j <= d[i]; j++){
				if(bk[i][j] == 1){
					dis[i][e[i][j]] = dis[e[i][j]][i] = 1;
				}else if(bk[i][j] == 2){
					p = fa[i][dep[i] - e[i][j]];
					dis[i][p] = dis[p][i] = 1;
				}
			}
		}
		for(p = 1; p <= n; p++){
			for(i = 1; i <= n; i++){
				for(j = 1; j <= n; j++) dis[i][j] = min(dis[i][j], dis[i][p] + dis[p][j]);
			}
		}
		for(i = 1; i <= R; i++) ans[i] = 0;
		for(i = 1; i <= n; i++){
			for(j = i + 1; j <= n; j++) ans[dis[i][j]]++;
		}
		for(i = 1; i <= R; i++){
			Answer(i, ans[i]);
		}
	}
}
void Inspect(int R){
	my_code::Inspect(R);
}

詳細信息

Subtask #1:

score: 0
Runtime Error

Test #1:

score: 17
Accepted
time: 1ms
memory: 4208kb

input:

10 100 50
7
5 7 10 4 6 2 3
2
1 5
3
1 10 7
2
10 1
3
1 9 2
2
1 7
5
9 6 8 3 1
1
7
2
5 7
3
1 4 3
15
24
6
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

output:

Accepted: #move = 210

result:

ok 

Test #2:

score: 17
Accepted
time: 1ms
memory: 4316kb

input:

50 100 50
2
39 10
4
7 43 11 33
2
7 18
1
14
3
46 42 27
2
12 49
4
2 41 3 35
1
37
1
14
4
13 14 19 1
3
22 2 44
1
6
4
49 21 10 36
6
4 9 35 10 37 20
1
49
2
21 29
2
45 25
2
3 28
2
10 38
2
50 14
2
16 13
1
11
1
38
1
41
1
17
2
48 32
3
40 5 48
1
18
1
16
1
49
1
40
1
26
1
2
1
50
2
7 14
1
13
2
8 14
2
23 19
2
45 1...

output:

Accepted: #move = 700

result:

ok 

Test #3:

score: 0
Runtime Error

input:

50 100 10
2
4 41
1
33
3
25 27 13
2
30 1
4
28 11 8 22
2
36 39
1
10
1
5
2
35 30
2
35 7
2
32 5
1
26
3
49 21 3
4
19 29 20 22
1
23
1
49
2
18 42
2
50 17
1
14
1
14
2
22 13
3
5 14 21
2
28 15
2
29 36
2
3 34
3
12 31 34
1
3
2
5 23
4
24 38 14 40
5
4 45 33 9 39
2
38 26
2
48 11
2
2 30
3
46 25 26
2
9 10
2
6 24
1
5...

output:

Wrong Answer [4]

result:


Subtask #2:

score: 0
Runtime Error

Test #16:

score: 27
Accepted
time: 1ms
memory: 4204kb

input:

10 3 50
4
7 4 10 5
2
8 6
1
10
2
1 9
3
1 7 10
2
7 2
5
6 1 5 8 9
3
7 9 2
4
10 8 7 4
4
1 9 5 3
15
19
9
2
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

output:

Accepted: #move = 210

result:

ok 

Test #17:

score: 27
Accepted
time: 0ms
memory: 4236kb

input:

50 3 50
1
5
1
42
3
48 14 28
1
23
3
36 22 1
2
44 14
3
38 14 26
1
37
2
24 45
2
40 42
1
37
1
33
3
21 23 49
4
3 7 47 6
3
41 39 24
2
40 18
1
38
1
16
1
30
1
22
1
13
3
5 20 28
2
13 4
4
28 37 15 9
1
30
2
7 50
2
30 47
3
24 22 3
3
32 47 40
3
19 27 25
3
35 37 44
3
43 29 33
2
12 32
1
37
1
31
1
5
6
34 46 31 8 24...

output:

Accepted: #move = 700

result:

ok 

Test #18:

score: 0
Runtime Error

input:

50 3 10
2
28 25
3
23 30 25
3
6 10 46
1
47
1
39
2
3 29
2
28 24
3
41 42 45
1
21
1
3
2
33 38
2
50 38
2
44 17
2
41 31
2
23 20
1
48
4
37 21 50 13
1
49
2
41 31
1
15
2
17 9
1
24
4
48 40 2 15
2
7 22
2
2 1
3
39 30 27
2
36 26
2
7 1
3
6 43 30
5
47 29 26 42 2
2
19 14
1
39
2
41 11
1
39
1
43
1
27
1
17
3
11 49 12
...

output:

Wrong Answer [4]

result:


Subtask #3:

score: 56
Accepted

Test #31:

score: 56
Accepted
time: 7ms
memory: 4964kb

input:

200 3 200
6
149 79 143 164 179 68
4
44 52 144 113
1
84
3
31 188 166
1
109
4
154 192 125 147
1
198
4
103 27 192 95
3
33 166 179
1
125
3
31 61 150
3
168 152 161
2
67 64
1
136
2
150 17
1
192
2
15 142
2
56 122
1
35
2
97 200
2
129 22
4
72 134 31 21
2
53 82
4
195 181 104 146
1
78
1
88
3
8 78 127
4
152 200...

output:

Accepted: #move = 2940

result:

points 1.0 L = 14.000000000000

Test #32:

score: 56
Accepted
time: 7ms
memory: 4916kb

input:

200 3 200
8
149 79 143 164 179 68 5 54
4
44 52 113 144
2
152 84
3
166 188 31
3
1 149 109
6
125 192 140 147 154 182
1
198
6
29 103 95 27 192 44
3
166 33 179
5
105 189 125 120 79
3
150 61 31
5
161 179 152 168 186
3
124 67 64
2
136 104
2
17 150
2
93 192
3
142 21 15
5
122 47 56 62 29
1
35
2
97 200
4
22 ...

output:

Accepted: #move = 4200

result:

points 1.0 L = 14.000000000000

Test #33:

score: 56
Accepted
time: 7ms
memory: 4916kb

input:

200 3 200
11
149 79 143 164 179 190 5 54 123 22 68
11
43 6 165 52 44 45 144 197 113 142 96
9
74 182 152 49 84 128 26 106 22
12
188 66 50 127 9 104 31 166 128 123 191 43
9
179 128 60 13 149 47 109 1 178
13
81 23 84 31 67 192 154 182 125 140 2 147 51
7
198 155 32 123 27 169 171
12
27 106 157 192 174 9...

output:

Accepted: #move = 14000

result:

points 1.0 L = 14.000000000000

Test #34:

score: 56
Accepted
time: 12ms
memory: 4980kb

input:

200 3 200
198
116 13 87 107 11 78 74 63 61 37 25 98 130 91 179 53 16 122 140 114 182 23 191 75 67 49 5 190 161 134 156 129 160 35 118 149 76 115 73 97 166 174 4 153 9 27 192 68 72 90 56 126 196 10 165 169 12 86 112 154 69 85 180 104 83 105 171 170 197 28 21 40 128 186 93 181 187 71 119 145 111 100 1...

output:

Accepted: #move = 277200

result:

points 1.0 L = 14.000000000000

Test #35:

score: 56
Accepted
time: 0ms
memory: 4376kb

input:

64 3 200
6
33 28 46 15 58 60
6
4 9 7 29 6 23
6
26 55 24 60 47 15
6
2 60 10 55 62 28
6
46 59 33 57 42 37
6
62 13 27 40 2 50
6
10 37 2 19 27 59
6
11 32 47 51 24 30
6
60 2 37 26 13 33
6
7 41 4 44 49 48
6
8 34 14 16 52 64
6
57 56 15 46 30 24
6
53 6 16 14 9 18
6
47 40 11 13 26 25
6
35 17 12 1 61 3
6
51 2...

output:

Accepted: #move = 2688

result:

points 1.0 L = 14.000000000000

Test #36:

score: 56
Accepted
time: 2ms
memory: 4684kb

input:

128 3 200
7
76 20 77 118 67 79 19
7
59 10 117 87 57 48 126
7
4 124 120 18 9 108 102
7
3 50 85 64 112 33 34
7
90 67 111 16 20 91 28
7
128 9 100 74 124 29 63
7
20 76 46 56 90 27 45
7
21 96 56 46 58 123 70
7
112 6 109 54 3 106 81
7
51 2 60 14 39 86 122
7
49 37 106 88 101 109 119
7
89 61 105 15 127 26 7...

output:

Accepted: #move = 6272

result:

points 1.0 L = 14.000000000000

Test #37:

score: 56
Accepted
time: 7ms
memory: 4848kb

input:

200 3 200
4
124 13 181 135
4
95 61 84 64
4
54 165 63 78
4
194 11 43 196
4
185 157 69 128
4
24 30 101 74
4
119 47 33 123
4
104 87 142 9
4
104 87 8 142
4
165 153 169 152
4
43 196 4 104
4
25 29 34 177
4
181 135 1 113
4
96 116 176 100
4
179 151 108 80
4
37 90 162 40
4
103 77 73 109
4
156 182 129 107
4
6...

output:

Accepted: #move = 5600

result:

points 1.0 L = 14.000000000000

Test #38:

score: 56
Accepted
time: 7ms
memory: 4972kb

input:

200 3 200
7
129 74 118 72 42 139 98
7
109 150 8 167 89 54 27
7
150 188 92 142 120 197 169
7
121 146 152 63 53 159 65
7
180 145 34 35 128 177 119
7
17 11 122 37 135 14 170
7
174 187 183 21 160 151 192
7
109 150 167 89 2 54 27
7
176 29 15 78 140 66 198
7
165 179 141 76 56 103 110
7
122 37 135 14 170 6...

output:

Accepted: #move = 9800

result:

points 1.0 L = 14.000000000000

Test #39:

score: 56
Accepted
time: 7ms
memory: 4844kb

input:

200 3 200
9
98 64 145 124 111 33 105 66 199
9
121 187 39 175 25 167 127 42 137
9
116 85 17 9 154 99 24 139 104
9
41 72 10 119 89 160 13 129 47
9
181 81 168 161 185 157 59 82 35
9
192 117 182 106 77 188 88 144 156
9
94 122 130 165 177 74 101 172 184
9
176 52 189 170 73 95 118 195 197
9
116 85 17 154 ...

output:

Accepted: #move = 12600

result:

points 1.0 L = 14.000000000000

Test #40:

score: 56
Accepted
time: 7ms
memory: 4980kb

input:

200 3 200
4
5 3 2 4
4
3 5 4 1
4
195 2 5 1
4
2 5 6 1
4
3 1 4 2
4
4 8 13 12
4
9 13 8 17
4
7 9 6 10
4
8 10 7 11
4
12 8 11 9
4
9 13 12 10
4
10 11 13 6
4
7 11 12 6
4
15 20 16 19
4
16 17 14 20
4
18 14 15 17
4
19 15 7 16
4
21 16 20 19
4
20 17 14 18
4
18 14 19 15
4
26 23 18 25
4
24 23 29 26
4
25 21 24 22
4
...

output:

Accepted: #move = 5600

result:

points 1.0 L = 14.000000000000

Test #41:

score: 56
Accepted
time: 3ms
memory: 4932kb

input:

200 3 200
6
2 9 8 4 3 7
6
8 9 5 1 3 4
6
9 6 5 2 4 1
6
6 2 3 5 7 1
6
194 2 3 7 8 4
6
7 9 11 8 4 3
6
5 1 9 8 6 4
6
2 5 6 1 7 9
6
2 1 7 6 3 8
6
14 11 15 16 13 12
6
16 15 6 12 13 10
6
11 10 16 13 15 14
6
11 10 16 15 14 12
6
15 12 21 10 13 16
6
10 12 11 13 16 14
6
13 11 14 12 10 15
6
22 18 21 20 19 23
6
...

output:

Accepted: #move = 8400

result:

points 1.0 L = 14.000000000000

Test #42:

score: 56
Accepted
time: 7ms
memory: 4976kb

input:

200 3 200
8
10 8 3 9 2 11 4 5
8
4 1 5 3 6 11 9 10
8
4 1 10 11 7 6 2 5
8
1 3 6 5 7 11 8 2
8
8 7 2 9 3 1 4 6
8
4 8 7 9 200 5 3 2
8
9 10 8 4 11 6 5 3
8
10 5 11 1 6 7 9 4
8
5 7 8 6 1 10 11 2
8
1 7 9 11 8 2 14 3
8
9 10 8 1 2 3 7 4
8
16 23 13 24 14 15 22 21
8
24 23 16 12 14 17 15 22
8
13 10 24 18 15 16 12...

output:

Accepted: #move = 11200

result:

points 1.0 L = 14.000000000000

Test #43:

score: 56
Accepted
time: 8ms
memory: 4768kb

input:

200 3 200
40
2 31 35 42 47 4 48 12 13 21 14 11 39 10 19 38 40 17 9 49 18 5 36 20 46 33 43 45 7 6 30 37 44 41 3 16 15 8 34 32
40
49 36 37 15 41 48 35 44 22 42 47 46 6 33 38 9 16 12 11 4 17 5 14 1 32 31 8 20 34 40 43 19 7 3 13 21 10 45 39 18
40
41 32 2 7 8 10 39 49 9 43 42 33 12 15 17 45 18 44 47 16 2...

output:

Accepted: #move = 56000

result:

points 1.0 L = 14.000000000000

Test #44:

score: 56
Accepted
time: 7ms
memory: 4900kb

input:

200 3 200
1
120
1
120
2
154 99
2
156 98
2
72 192
1
190
1
71
2
65 113
4
149 131 163 196
3
172 76 78
2
59 186
1
32
4
183 147 129 145
3
160 188 195
2
185 159
2
139 78
2
65 71
3
177 64 60
1
97
3
155 171 75
1
37
1
186
1
137
2
77 132
1
131
2
45 147
1
141
1
187
2
91 144
4
165 154 179 138
2
143 159
2
12 130...

output:

Accepted: #move = 2828

result:

points 1.0 L = 14.000000000000

Test #45:

score: 56
Accepted
time: 7ms
memory: 4980kb

input:

200 3 200
4
3 6 2 5
4
4 3 1 6
4
4 2 1 200
4
5 2 3 6
4
1 6 4 11
4
2 1 4 5
4
9 11 8 12
4
7 9 10 12
4
11 8 10 7
4
12 11 8 9
4
5 9 7 10
4
15 10 7 8
4
15 14 21 20
4
21 13 16 15
4
12 14 17 13
4
18 23 14 17
4
18 19 16 15
4
19 17 20 16
4
21 17 20 18
4
19 21 13 18
4
13 14 20 19
4
23 27 28 24
4
22 28 25 16
4
...

output:

Accepted: #move = 5600

result:

points 1.0 L = 14.000000000000

Test #46:

score: 56
Accepted
time: 2ms
memory: 4440kb

input:

100 3 100
96
58 96 22 38 60 71 49 20 34 83 57 18 90 75 73 43 8 2 63 51 11 46 81 61 50 31 92 87 44 64 40 10 14 4 21 32 88 52 9 66 100 93 48 89 78 16 97 82 62 6 69 72 98 13 41 39 59 80 36 26 29 84 35 19 94 54 28 25 86 76 23 68 17 15 53 99 85 33 5 70 45 55 65 56 47 74 79 42 24 77 3 67 7 12 95 37
96
57 ...

output:

Accepted: #move = 65198

result:

points 1.0 L = 14.000000000000

Test #47:

score: 56
Accepted
time: 11ms
memory: 4944kb

input:

200 3 50
196
192 18 91 149 145 72 185 32 99 133 130 131 16 40 183 137 155 176 47 126 21 106 164 49 29 85 200 127 26 51 65 78 25 175 8 97 141 96 161 156 120 27 46 3 36 55 177 110 70 198 59 119 135 62 34 143 20 94 112 160 100 63 134 157 195 44 11 196 139 42 181 115 140 114 132 169 168 136 162 122 151 ...

output:

Accepted: #move = 270298

result:

points 1.0 L = 14.000000000000

Test #48:

score: 56
Accepted
time: 11ms
memory: 4920kb

input:

200 3 50
189
146 164 90 194 199 37 56 137 71 125 105 127 115 10 111 86 45 200 159 30 57 101 160 112 167 2 117 147 151 138 157 165 173 192 16 23 177 163 8 148 63 67 185 179 118 129 162 87 183 136 113 161 131 100 156 5 169 88 196 139 168 4 124 92 20 7 80 24 69 195 29 132 174 46 134 181 83 104 198 82 1...

output:

Accepted: #move = 251412

result:

points 1.0 L = 14.000000000000

Test #49:

score: 56
Accepted
time: 11ms
memory: 4976kb

input:

200 3 50
189
36 131 72 74 175 88 147 57 110 97 32 186 90 120 152 69 102 67 159 83 81 138 187 107 24 191 137 82 130 20 100 49 27 18 135 141 77 91 63 54 133 103 35 136 157 122 171 21 55 59 50 109 10 199 6 170 167 68 12 158 178 149 14 177 73 65 198 132 16 58 11 172 92 5 60 7 28 31 183 129 70 75 17 118 ...

output:

Accepted: #move = 251118

result:

points 1.0 L = 14.000000000000