QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#359956#408. Dungeon 24QT0R0 0ms0kbC++201.8kb2024-03-21 05:54:432024-03-21 05:54:44

Judging History

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

  • [2024-03-21 05:54:44]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:0kb
  • [2024-03-21 05:54:43]
  • 提交

answer

#include <bits/stdc++.h>
#include "dungeon2.h"
using namespace std;
#define pii pair<int,int>

vector<int> graph[203];
vector<int> typ[203];
vector<int> dek[203];
int wyn[203];
pii fat[203];
int deg[203];
int wolne=0;

void init(int v, int p){
	deg[v]=NumberOfRoads();
	graph[v].resize(deg[v]+1);
	typ[v].resize(deg[v]+1);
	dek[v].resize(deg[v]+1);
	if (v!=1){
		fat[v]={p,LastRoad()};
		graph[v][LastRoad()]=p;
		typ[v][LastRoad()]=-2;
	}
	for (int i = 1; i<=deg[v]; i++){
		if (i==fat[v].second)continue;
		Move(i,2);
		if (Color()==2){
			Move(LastRoad(),2);
			typ[v][LastRoad()]=1;
		}
		else if (Color()==3){
			Move(LastRoad(),3);
			typ[v][LastRoad()]=-1;
		}
		else{
			graph[v][i]=++wolne;
			init(wolne,v);
		}
	}
	if (v!=1)Move(fat[v].second,3);
}

void dfs(int v, int d){
	for (int i = 1; i<=deg[v]; i++){
		if (typ[v][i]==0){
			Move(i,(v/d)%3+1);
			dfs(graph[v][i],d);
		}
		if (typ[v][i]==1){
			Move(i,Color());
			dek[v][i]+=(d*(Color()-1));
			Move(LastRoad(),Color());
		}
	}
	if (v!=1)Move(fat[v].second,1);
}

vector<int> final_graph[202];
int odl[202];

void bfs(int v, int n){
	fill(odl,odl+n+1,1000);
	queue<int> q;
	q.push(v);
	odl[v]=0;
	while(q.size()){
		int now=q.front();
		q.pop();
		for (auto u : graph[now])if (odl[u]>odl[now]){
			q.push(u);
			odl[u]=odl[now]+1;
			wyn[odl[u]]++;
		}
	}
	
}

void Inspect(int R){
	init(++wolne,0);
	int n=wolne,cur=1,dziel=3;
	for (int dziel = 3; dziel<=n; dziel*=3){
		dfs(1,dziel);
	}
	for (int i = 2; i<=n; i++){
		for (int j = 1; j<=deg[i]; j++){
			if (typ[i][j]==1)final_graph[i].push_back(dek[i][j]);
			else final_graph[i].push_back(graph[i][j]);
		}
	}
	for (int i = 1; i<=n; i++){
		bfs(i,n);
	}
	for (int i = 1; i<=R; i++){
		Answer(i,wyn[i]/2);
	}
}

詳細信息

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: 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 [4]

result: