| Task: | Hypyt |
| Sender: | Tmotomaster |
| Submission time: | 2025-11-02 21:27:25 +0200 |
| Language: | C++ (C++20) |
| Status: | READY |
| Result: | 0 |
| group | verdict | score |
|---|---|---|
| #1 | WRONG ANSWER | 0 |
| #2 | WRONG ANSWER | 0 |
| #3 | WRONG ANSWER | 0 |
| #4 | WRONG ANSWER | 0 |
| #5 | WRONG ANSWER | 0 |
| test | verdict | time | group | |
|---|---|---|---|---|
| #1 | WRONG ANSWER | 0.00 s | 1, 2, 3, 4, 5 | details |
| #2 | WRONG ANSWER | 0.00 s | 1, 2, 3, 4, 5 | details |
| #3 | WRONG ANSWER | 0.00 s | 1, 2, 3, 4, 5 | details |
| #4 | WRONG ANSWER | 0.00 s | 1, 2, 3, 4, 5 | details |
| #5 | WRONG ANSWER | 0.00 s | 1, 2, 3, 4, 5 | details |
| #6 | WRONG ANSWER | 0.00 s | 2, 5 | details |
| #7 | WRONG ANSWER | 0.00 s | 2, 5 | details |
| #8 | WRONG ANSWER | 0.00 s | 2, 5 | details |
| #9 | WRONG ANSWER | 0.00 s | 3, 4, 5 | details |
| #10 | WRONG ANSWER | 0.00 s | 3, 4, 5 | details |
| #11 | WRONG ANSWER | 0.00 s | 3, 4, 5 | details |
| #12 | WRONG ANSWER | 0.00 s | 4, 5 | details |
| #13 | WRONG ANSWER | 0.00 s | 4, 5 | details |
| #14 | WRONG ANSWER | 0.00 s | 4, 5 | details |
| #15 | WRONG ANSWER | 0.00 s | 5 | details |
| #16 | WRONG ANSWER | 0.00 s | 5 | details |
| #17 | WRONG ANSWER | 0.00 s | 5 | details |
| #18 | WRONG ANSWER | 0.00 s | 5 | details |
| #19 | WRONG ANSWER | 0.00 s | 5 | details |
| #20 | WRONG ANSWER | 0.00 s | 5 | details |
| #21 | WRONG ANSWER | 0.00 s | 5 | details |
| #22 | WRONG ANSWER | 0.00 s | 1, 2, 3, 4, 5 | details |
| #23 | WRONG ANSWER | 0.00 s | 1, 2, 3, 4, 5 | details |
| #24 | WRONG ANSWER | 0.00 s | 5 | details |
| #25 | WRONG ANSWER | 0.00 s | 5 | details |
| #26 | WRONG ANSWER | 0.00 s | 5 | details |
| #27 | WRONG ANSWER | 0.00 s | 5 | details |
Compiler report
input/code.cpp: In member function 'std::pair<bool, std::vector<Space*> > Space::checkHorizontal(int, int, int)':
input/code.cpp:32:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<Space*>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
32 | for (int i = 0; i < horizontal.size(); i++) {
| ~~^~~~~~~~~~~~~~~~~~~
input/code.cpp: In member function 'std::pair<bool, std::vector<Space*> > Space::checkVertical(int, int, int)':
input/code.cpp:45:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<Space*>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
45 | for (int i = 0; i < vertical.size(); i++) {
| ~~^~~~~~~~~~~~~~~~~
input/code.cpp: In function 'int main()':
input/code.cpp:71:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<Space*>::size_type' {aka 'long unsigned int'} [-Wsign-c...Code
#include <iostream>
#include <string>
#include <vector>
#include <utility>
using namespace std;
struct Space {
int posX, posY;
vector<Space*> horizontal;
vector<Space*> vertical;
int lastChecked = -1;
Space(int x, int y) {
posX = x;
posY = y;
}
void addHorizontal(Space* s) {
horizontal.push_back(s);
}
void addVertical(Space* s) {
vertical.push_back(s);
}
pair<bool, vector<Space*>> checkHorizontal(int x, int y, int check) {
// put output to vertical list thing and other schenanigans; shoud work better than that ugly recursion.
vector<Space*> targetList;
if (posX == x && posY == y) {
return {true, targetList};
}
for (int i = 0; i < horizontal.size(); i++) {
if (horizontal[i]->lastChecked == check) continue;
horizontal[i]->lastChecked = check;
targetList.push_back(horizontal[i]);
}
return {false, targetList};
}
pair<bool, vector<Space*>> checkVertical(int x, int y, int check) {
vector<Space*> targetList;
if (posX == x && posY == y) {
return {true, targetList};
}
for (int i = 0; i < vertical.size(); i++) {
if (vertical[i]->lastChecked == check) continue;
vertical[i]->lastChecked = check;
targetList.push_back(vertical[i]);
}
return {false, targetList};
}
};
int main() {
freopen("output.txt", "r", stdin);
int n, m, q;
cin >> n >> m >> q;
Space* spaces[250][250];
vector<Space*>* columns = new vector<Space*>[m];
for (int i = 0; i < n; i++) {
string row;
cin >> row;
vector<Space*> rowSpaces;
for (int j = 0; j < m; j++) {
if (row[j] != '.') continue;
Space* newSpace = new Space(i, j);
spaces[i][j] = newSpace;
for (int k = 0; k < rowSpaces.size(); k++) {
rowSpaces[k]->addHorizontal(newSpace);
newSpace->addHorizontal(rowSpaces[k]);
}
rowSpaces.push_back(newSpace);
for (int k = 0; k < columns[j].size(); k++) {
columns[j][k]->addVertical(newSpace);
newSpace->addVertical(columns[j][k]);
}
columns[j].push_back(newSpace);
}
}
int* results = new int[q];
for (int i = 0; i < q; i++) {
int y1, x1, y2, x2;
cin >> y1 >> x1 >> y2 >> x2;
--y1; --x1;
--y2; --x2;
vector<Space*> toCheckX = {spaces[y1][x1]};
vector<Space*> toCheckY = {spaces[y1][x1]};
bool found = false;
int steps = 0;
while (toCheckX.size() > 0 || toCheckY.size() > 0) {
vector<Space*> newCheckX = toCheckX;
vector<Space*> newCheckY = toCheckY;
toCheckX.clear();
toCheckY.clear();
for (int j = 0; j < newCheckX.size(); j++) {
pair<bool, vector<Space*>> result = newCheckX[j]->checkHorizontal(y2, x2, i);
if (result.first) {
found = true;
break;
}
for (int j = 0; j < result.second.size(); j++) {
toCheckY.push_back(result.second[j]);
}
// toCheckY = result.second;
}
if (found) break;
// if (newCheckY.size() == 0) break;
for (int j = 0; j < newCheckY.size(); j++) {
pair<bool, vector<Space*>> result = newCheckY[j]->checkVertical(y2, x2, i);
if (result.first) {
found = true;
break;
}
for (int j = 0; j < result.second.size(); j++) {
toCheckX.push_back(result.second[j]);
}
// toCheckX = result.second;
}
if (found) break;
++steps;
}
results[i] = found ? steps : -1;
}
for (int i = 0; i < q; i++) {
cout << results[i] << '\n';
}
return 0;
}Test details
Test 1 (public)
Group: 1, 2, 3, 4, 5
Verdict: WRONG ANSWER
| input |
|---|
| 4 6 5 .*.*** *...** *****. *..*.* ... |
| correct output |
|---|
| 1 0 3 3 -1 |
| user output |
|---|
| (empty) |
Feedback: Output is shorter than expected
Test 2
Group: 1, 2, 3, 4, 5
Verdict: WRONG ANSWER
| input |
|---|
| 10 10 10 .......... .....*.... ........*. *.*....*.. ... |
| correct output |
|---|
| 1 2 1 2 2 ... |
| user output |
|---|
| (empty) |
Feedback: Output is shorter than expected
Test 3
Group: 1, 2, 3, 4, 5
Verdict: WRONG ANSWER
| input |
|---|
| 10 10 10 *...***.** *****.*... **..**.**. ..**.**.*. ... |
| correct output |
|---|
| 1 2 2 1 2 ... |
| user output |
|---|
| (empty) |
Feedback: Output is shorter than expected
Test 4
Group: 1, 2, 3, 4, 5
Verdict: WRONG ANSWER
| input |
|---|
| 10 10 10 ***.*.**** ********** *.******** .*.***.**. ... |
| correct output |
|---|
| 3 4 2 3 4 ... |
| user output |
|---|
| (empty) |
Feedback: Output is shorter than expected
Test 5
Group: 1, 2, 3, 4, 5
Verdict: WRONG ANSWER
| input |
|---|
| 10 10 1 .****.**** **.**..*** ********** *******..* ... |
| correct output |
|---|
| 7 |
| user output |
|---|
| (empty) |
Feedback: Output is shorter than expected
Test 6
Group: 2, 5
Verdict: WRONG ANSWER
| input |
|---|
| 250 250 250 .*...*.....*******..**...*....... |
| correct output |
|---|
| 2 3 3 2 2 ... |
| user output |
|---|
| (empty) |
Feedback: Output is shorter than expected
Test 7
Group: 2, 5
Verdict: WRONG ANSWER
| input |
|---|
| 250 250 250 ...*......**.**.*.*..**..*..**... |
| correct output |
|---|
| 2 2 2 2 3 ... |
| user output |
|---|
| (empty) |
Feedback: Output is shorter than expected
Test 8
Group: 2, 5
Verdict: WRONG ANSWER
| input |
|---|
| 250 250 250 **..**..****.****.*.***.***..*... |
| correct output |
|---|
| 2 3 3 3 3 ... |
| user output |
|---|
| (empty) |
Feedback: Output is shorter than expected
Test 9
Group: 3, 4, 5
Verdict: WRONG ANSWER
| input |
|---|
| 40 40 200000 ...*.**.*..*.............*.*..... |
| correct output |
|---|
| 2 2 2 2 2 ... |
| user output |
|---|
| (empty) |
Feedback: Output is shorter than expected
Test 10
Group: 3, 4, 5
Verdict: WRONG ANSWER
| input |
|---|
| 40 40 200000 **.**..*.*.*.******....****.*.... |
| correct output |
|---|
| 2 1 3 2 2 ... |
| user output |
|---|
| (empty) |
Feedback: Output is shorter than expected
Test 11
Group: 3, 4, 5
Verdict: WRONG ANSWER
| input |
|---|
| 40 40 200000 .*.*.**.*****.***.*.****.**.**... |
| correct output |
|---|
| 3 3 3 3 3 ... |
| user output |
|---|
| (empty) |
Feedback: Output is shorter than expected
Test 12
Group: 4, 5
Verdict: WRONG ANSWER
| input |
|---|
| 80 80 200000 *....**.***..****...*.....*...... |
| correct output |
|---|
| 2 2 2 2 2 ... |
| user output |
|---|
| (empty) |
Feedback: Output is shorter than expected
Test 13
Group: 4, 5
Verdict: WRONG ANSWER
| input |
|---|
| 80 80 200000 .***.*..*.***..*****....**...*... |
| correct output |
|---|
| 3 2 2 3 2 ... |
| user output |
|---|
| (empty) |
Feedback: Output is shorter than expected
Test 14
Group: 4, 5
Verdict: WRONG ANSWER
| input |
|---|
| 80 80 200000 *******.*****.*..*..****...***... |
| correct output |
|---|
| 2 3 1 2 2 ... |
| user output |
|---|
| (empty) |
Feedback: Output is shorter than expected
Test 15
Group: 5
Verdict: WRONG ANSWER
| input |
|---|
| 250 250 200000 *....*..*..*..**..*.........**... |
| correct output |
|---|
| 3 2 2 2 2 ... |
| user output |
|---|
| (empty) |
Feedback: Output is shorter than expected
Test 16
Group: 5
Verdict: WRONG ANSWER
| input |
|---|
| 250 250 200000 ..*....*..*......*.**.*.*..***... |
| correct output |
|---|
| 2 2 2 2 2 ... |
| user output |
|---|
| (empty) |
Feedback: Output is shorter than expected
Test 17
Group: 5
Verdict: WRONG ANSWER
| input |
|---|
| 250 250 200000 *..*.*****.*********.****.****... |
| correct output |
|---|
| 3 3 2 2 2 ... |
| user output |
|---|
| (empty) |
Feedback: Output is shorter than expected
Test 18
Group: 5
Verdict: WRONG ANSWER
| input |
|---|
| 250 250 200000 *********.**********.******.**... |
| correct output |
|---|
| 3 3 3 3 3 ... |
| user output |
|---|
| (empty) |
Feedback: Output is shorter than expected
Test 19
Group: 5
Verdict: WRONG ANSWER
| input |
|---|
| 250 250 200000 .*****************************... |
| correct output |
|---|
| 104 422 145 93 65 ... |
| user output |
|---|
| (empty) |
Feedback: Output is shorter than expected
Test 20
Group: 5
Verdict: WRONG ANSWER
| input |
|---|
| 250 250 200000 ..****************************... |
| correct output |
|---|
| 57 155 38 65 98 ... |
| user output |
|---|
| (empty) |
Feedback: Output is shorter than expected
Test 21
Group: 5
Verdict: WRONG ANSWER
| input |
|---|
| 250 250 200000 .*****************************... |
| correct output |
|---|
| 498 498 498 498 498 ... |
| user output |
|---|
| (empty) |
Feedback: Output is shorter than expected
Test 22
Group: 1, 2, 3, 4, 5
Verdict: WRONG ANSWER
| input |
|---|
| 10 1 10 * * . * ... |
| correct output |
|---|
| 0 1 1 0 0 ... |
| user output |
|---|
| (empty) |
Feedback: Output is shorter than expected
Test 23
Group: 1, 2, 3, 4, 5
Verdict: WRONG ANSWER
| input |
|---|
| 1 10 10 ........*. 1 7 1 10 1 4 1 7 1 5 1 1 ... |
| correct output |
|---|
| 1 1 1 1 1 ... |
| user output |
|---|
| (empty) |
Feedback: Output is shorter than expected
Test 24
Group: 5
Verdict: WRONG ANSWER
| input |
|---|
| 250 1 200000 * . * . ... |
| correct output |
|---|
| 1 1 1 1 1 ... |
| user output |
|---|
| (empty) |
Feedback: Output is shorter than expected
Test 25
Group: 5
Verdict: WRONG ANSWER
| input |
|---|
| 1 250 200000 *.*.*...*.*.**.***..**.*.*..**... |
| correct output |
|---|
| 1 1 1 1 1 ... |
| user output |
|---|
| (empty) |
Feedback: Output is shorter than expected
Test 26
Group: 5
Verdict: WRONG ANSWER
| input |
|---|
| 250 250 200000 ................................. |
| correct output |
|---|
| 2 2 2 2 2 ... |
| user output |
|---|
| (empty) |
Feedback: Output is shorter than expected
Test 27
Group: 5
Verdict: WRONG ANSWER
| input |
|---|
| 250 250 200000 ******************************... |
| correct output |
|---|
| 0 0 0 0 0 ... |
| user output |
|---|
| (empty) |
Feedback: Output is shorter than expected
