QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#359688#408. Dungeon 2stevo0 0ms0kbC++201.2kb2024-03-20 20:01:272024-03-20 20:01:28

Judging History

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

  • [2024-03-20 20:01:28]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:0kb
  • [2024-03-20 20:01:27]
  • 提交

answer

#include <bits/stdc++.h>
#include "dungeon2.h"
using namespace std;
#define pb push_back
const int N = 203;
bool usd[N][N];
int idx=2, out[N], dist[N];
vector<int> grf[N];
void dfs(int p){
	int edg=NumberOfRoads();
	int v=Color();
	if(v==1){
		v=idx;
		idx++;
	}
	bool ben=0;
	if(p!=0){	
		grf[p].pb(v);
	}
	for(int i=1; i<=edg; i++){
		if(!usd[v][i]){
			ben=1;
			usd[v][i]=1;
			Move(i, v);
			dfs(v);
			break;
		}
	}
	if(!ben && p!=0){
		for(int i=0; i<edg; i++){
			if(grf[v][i]==p){
				Move(i+1, v);
				dfs(0);
				break;
			}
		}
	}
}
void getDst(int v){
	queue<int> Q;
	Q.push(v);
	dist[v]=0;
	while(!Q.empty()){
		int cur=Q.front();
		Q.pop();
		for(auto w:grf[cur]){
			if(dist[w]>dist[cur]+1){
				dist[w]=dist[cur]+1;
				Q.push(w);
			}
		}
	}
	for(int i=2; i<idx; i++){
		if(dist[i]>=N) continue;
		out[dist[i]]++;
	}
}
void Inspect(int R){
	dfs(0);
	for(int i=2; i<idx; i++){
		for(int j=2; j<idx; j++) dist[j]=N;
		getDst(i);
		/*cout << i << ": ";
		for(auto w:grf[i]) cout << w << ' ';
		cout << '\n';*/
	}
	for(int i=1; i<=R; i++){
		//cout << out[i]/2 << '\n';
		Answer(i, out[i]/2);
	}
}

Details

Tip: Click on the bar to expand more detailed information

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 [6]

result:


Subtask #3:

score: 0
Runtime Error

Test #31:

score: 0
Runtime Error

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:

Wrong Answer [6]

result: