QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#359889#408. Dungeon 2weajink228.118812 15ms4836kbC++141.9kb2024-03-20 23:20:462024-03-20 23:20:47

Judging History

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

  • [2024-03-20 23:20:47]
  • 评测
  • 测评结果:28.118812
  • 用时:15ms
  • 内存:4836kb
  • [2024-03-20 23:20:46]
  • 提交

answer

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

vector<pair<int,int> > sas[301];
vector<int> sas2[301];
vector<int> sas3[301];
int pt = 1;
void DFS(int v){
	int deg = NumberOfRoads();
	for (int i = 1; i <= deg; i++){
		Move(i,2);
		int cof = LastRoad();
		if (Color() == 2){
			sas2[v].push_back(i);
			sas3[v].push_back(0);
			Move(cof,2);
		}else{
			pt++;
			sas[v].push_back({pt,i});
			DFS(pt);
			Move(cof,2);
		}
	}
}
int zwroc(int v, int bit){
	if (v&(1<<bit)) return 2;
	return 1;
}
void pokoloruj(int v, int bit){
	for (auto j : sas[v]){
		//cout<<"bit = "<<bit<<" Kolorujemy "<<v<<" na "<<zwroc(v,bit)<<"\n";
		Move(j.second,zwroc(v,bit));
		int cof = LastRoad();
		pokoloruj(j.first,bit);
		Move(cof,zwroc(j.first,bit));
	}
}
void DFS2(int v, int bit){
	for (int i = 0; i < (int)sas2[v].size(); i++){
		Move(sas2[v][i],Color());
		if (Color() == 2) sas3[v][i] += (1<<bit);
		Move(LastRoad(),Color());
	}	
	for (auto j : sas[v]){
		Move(j.second,Color());
		int cof = LastRoad();
		DFS2(j.first,bit);
		Move(cof,Color());
	}	
}
void Inspect(int R){
	DFS(1);
	for (int i = 0; i < 8; i++){
		pokoloruj(1,i);
		DFS2(1,i);
	}
	int odl[R+1];
	for (int i = 0; i <= R; i++) odl[i]= 0 ;
	for (int v = 1; v <= pt; v++){
		int dist[pt+1];
		for (int u = 1; u <= pt; u++) dist[u] = -1;
		queue<int> Q;
		Q.push(v);
		dist[v] = 0;
		while (Q.size()){
			int u = Q.front();
			Q.pop();
			for (auto j : sas[u]){
				int z = j.first;
				if (dist[z] == -1){
					dist[z] = dist[u]+1;
					Q.push(z);
				}
			}	
			for (int z : sas3[u]){
				if (dist[z] == -1){
					dist[z] = dist[u]+1;
					Q.push(z);
				}
			}	
		}
		for (int u = v+1; u <= pt; u++){
			if (dist[u] == -1) continue;
			odl[dist[u]]++;
		}
	}
	for (int i = 1; i <= R; i++){
	//	cout<<i<<" "<<odl[i]<<"\n";
		Answer(i,odl[i]);
	}
}

详细

Subtask #1:

score: 0
Runtime Error

Test #1:

score: 17
Accepted
time: 0ms
memory: 3888kb

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 = 684

result:

ok 

Test #2:

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

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 = 2584

result:

ok 

Test #3:

score: -17
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:

Unauthorized output

result:


Subtask #2:

score: 0
Runtime Error

Test #16:

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

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 = 684

result:

ok 

Test #17:

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

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 = 2584

result:

ok 

Test #18:

score: -27
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:

Unauthorized output

result:


Subtask #3:

score: 28.1188
Acceptable Answer

Test #31:

score: 28.419
Acceptable Answer
time: 1ms
memory: 4120kb

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 = 10744

result:

points 0.50748299320 L = 51.161904761905

Test #32:

score: 30.6933
Acceptable Answer
time: 2ms
memory: 4148kb

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 = 13984

result:

points 0.54809523810 L = 46.613333333333

Test #33:

score: 34.408
Acceptable Answer
time: 0ms
memory: 4448kb

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 = 39184

result:

points 0.61442857140 L = 39.184000000000

Test #34:

score: 35.9196
Acceptable Answer
time: 11ms
memory: 4548kb

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 = 715984

result:

points 0.64142135640 L = 36.160808080808

Test #35:

score: 33.375
Acceptable Answer
time: 1ms
memory: 3948kb

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 = 7920

result:

points 0.59598214290 L = 41.250000000000

Test #36:

score: 33.7321
Acceptable Answer
time: 1ms
memory: 3988kb

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 = 18160

result:

points 0.60235969390 L = 40.535714285714

Test #37:

score: 32.02
Acceptable Answer
time: 1ms
memory: 4152kb

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 = 17584

result:

points 0.57178571430 L = 43.960000000000

Test #38:

score: 33.7257
Acceptable Answer
time: 0ms
memory: 4136kb

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 = 28384

result:

points 0.6022448980 L = 40.548571428571

Test #39:

score: 34.2311
Acceptable Answer
time: 1ms
memory: 4132kb

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 = 35584

result:

points 0.61126984130 L = 39.537777777778

Test #40:

score: 32.02
Acceptable Answer
time: 1ms
memory: 4172kb

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 = 17584

result:

points 0.57178571430 L = 43.960000000000

Test #41:

score: 33.3467
Acceptable Answer
time: 1ms
memory: 4164kb

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 = 24784

result:

points 0.59547619050 L = 41.306666666667

Test #42:

score: 34.01
Acceptable Answer
time: 0ms
memory: 4400kb

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 = 31984

result:

points 0.60732142860 L = 39.980000000000

Test #43:

score: 35.602
Acceptable Answer
time: 0ms
memory: 4272kb

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 = 147184

result:

points 0.635750 L = 36.796000000000

Test #44:

score: 28.1188
Acceptable Answer
time: 1ms
memory: 4376kb

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 = 10456

result:

points 0.50212164070 L = 51.762376237624

Test #45:

score: 32.02
Acceptable Answer
time: 0ms
memory: 4436kb

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 = 17584

result:

points 0.57178571430 L = 43.960000000000

Test #46:

score: 35.8299
Acceptable Answer
time: 3ms
memory: 4068kb

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 = 169236

result:

points 0.63982023990 L = 36.340133132918

Test #47:

score: 35.9175
Acceptable Answer
time: 15ms
memory: 4836kb

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 = 698236

result:

points 0.64138469390 L = 36.164914279795

Test #48:

score: 35.9113
Acceptable Answer
time: 13ms
memory: 4564kb

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 = 649672

result:

points 0.6412740840 L = 36.177302594944

Test #49:

score: 35.9112
Acceptable Answer
time: 13ms
memory: 4532kb

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 = 648916

result:

points 0.64127223060 L = 36.177510174500