QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#359788 | #408. Dungeon 2 | user1234 | 0 | 0ms | 0kb | C++14 | 1.3kb | 2024-03-20 20:54:38 | 2024-03-20 20:54:39 |
answer
#include <bits/stdc++.h>
#include "dungeon2.h"
using namespace std;
int aktualny = 2;
vector <short> sasiedzi[204];
//int numer_ojca[204];
short n, m;
int odleglosci[201];
int zaglebienie[203];
void dfs() {
int k = NumberOfRoads();
int kolor = aktualny;
if (!k) return;
Move(1, kolor);
Move(LastRoad(), Color());
aktualny++;
for (int i = 1; i <= k; i++) {
Move(i, kolor);
int jak_wracamy = LastRoad();
if (Color() == 1) dfs();
sasiedzi[kolor].push_back(Color());
sasiedzi[aktualny].push_back(Color());
Move(jak_wracamy, Color());
}
}
void bfs(int x) {
if (!sasiedzi[x].size()) return;
fill(zaglebienie + 2, zaglebienie + 203, -1);
zaglebienie[x] = 0;
queue <int> kolejka;
kolejka.push(x);
while (!kolejka.empty()) {
int v = kolejka.front();
kolejka.pop();
for (int sasiad : sasiedzi[v]) {
if (zaglebienie[sasiad] != -1) continue;
zaglebienie[sasiad] = zaglebienie[x] + 1;
odleglosci[zaglebienie[sasiad]]++;
kolejka.push(sasiad);
}
}
}
void Inspect(int R) {
dfs();
for (int i = 2; i <= 201; i++) bfs(i);
for (int i = 1; i <= R; i++) Answer(i, odleglosci[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]