QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#359899#408. Dungeon 2weajink20 1ms4088kbC++142.0kb2024-03-20 23:29:012024-03-20 23:29:02

Judging History

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

  • [2024-03-20 23:29:02]
  • 评测
  • 测评结果:0
  • 用时:1ms
  • 内存:4088kb
  • [2024-03-20 23:29:01]
  • 提交

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];
vector<int> sas4[301];
int pt = 1;
void DFS(int v){
	int deg = NumberOfRoads();
	for (int i = 1; i <= deg; i++){
		Move(i,3);
		int cof = LastRoad();
		if (Color() == 2){
			sas2[v].push_back(i);
			sas3[v].push_back(0);
			Move(cof,2);
		}else if (Color() == 1){
			pt++;
			sas[v].push_back({pt,i});
			DFS(pt);
			Move(cof,2);
		}else{
			Move(cof,3);
		}
	}
}
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[max(R+1,pt+1)];
	for (int i = 0; i <= R; i++) odl[i]= 0 ;
	for (int v = 1; v <= pt; v++){
		for (auto j : sas[v]){
			sas4[v].push_back(j.first);
			sas4[j.first].push_back(v);
		}
		for (int u : sas3[v]){
			sas4[v].push_back(u);
			sas4[u].push_back(v);
		}		
	}
	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 (int z : sas4[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
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3832kb

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:

Unauthorized output

result:

wrong answer 

Subtask #2:

score: 0
Wrong Answer

Test #16:

score: 0
Wrong Answer
time: 0ms
memory: 3828kb

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:

Unauthorized output

result:

wrong answer 

Subtask #3:

score: 0
Wrong Answer

Test #31:

score: 0
Wrong Answer
time: 1ms
memory: 4088kb

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:

Unauthorized output

result:

wrong answer