QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#359879#408. Dungeon 2weajink20 15ms4836kbC++141.8kb2024-03-20 23:00:462024-03-20 23:00:48

Judging History

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

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

answer

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

vector<pair<int,int> > sas[201];
vector<int> sas2[201];
vector<int> sas3[201];
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[pt+1];
	for (int i = 0; i <= pt; 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++) 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: 0
Runtime Error

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:

Wrong Answer [4]

result:


Subtask #2:

score: 0
Runtime Error

Test #16:

score: 0
Runtime Error

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:

Wrong Answer [4]

result:


Subtask #3:

score: 0
Runtime Error

Test #31:

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

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

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: 2ms
memory: 4436kb

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: 15ms
memory: 4836kb

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: 0
Runtime Error

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:

Wrong Answer [4]

result: