| Task: | Hypyt |
| Sender: | rendes |
| Submission time: | 2025-11-05 21:34:52 +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 | ACCEPTED | 0.00 s | 1, 2, 3, 4, 5 | details |
| #2 | ACCEPTED | 0.00 s | 1, 2, 3, 4, 5 | details |
| #3 | ACCEPTED | 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 | ACCEPTED | 0.00 s | 2, 5 | details |
| #7 | ACCEPTED | 0.00 s | 2, 5 | details |
| #8 | ACCEPTED | 0.00 s | 2, 5 | details |
| #9 | ACCEPTED | 0.09 s | 3, 4, 5 | details |
| #10 | ACCEPTED | 0.09 s | 3, 4, 5 | details |
| #11 | WRONG ANSWER | 0.10 s | 3, 4, 5 | details |
| #12 | ACCEPTED | 0.09 s | 4, 5 | details |
| #13 | ACCEPTED | 0.09 s | 4, 5 | details |
| #14 | WRONG ANSWER | 0.10 s | 4, 5 | details |
| #15 | ACCEPTED | 0.10 s | 5 | details |
| #16 | ACCEPTED | 0.10 s | 5 | details |
| #17 | ACCEPTED | 0.11 s | 5 | details |
| #18 | WRONG ANSWER | 0.15 s | 5 | details |
| #19 | WRONG ANSWER | 0.23 s | 5 | details |
| #20 | WRONG ANSWER | 0.23 s | 5 | details |
| #21 | WRONG ANSWER | 0.22 s | 5 | details |
| #22 | ACCEPTED | 0.00 s | 1, 2, 3, 4, 5 | details |
| #23 | ACCEPTED | 0.00 s | 1, 2, 3, 4, 5 | details |
| #24 | ACCEPTED | 0.08 s | 5 | details |
| #25 | ACCEPTED | 0.09 s | 5 | details |
| #26 | ACCEPTED | 0.10 s | 5 | details |
| #27 | ACCEPTED | 0.08 s | 5 | details |
Compiler report
input/code.cpp: In function 'int solveslow(uint8_t, uint8_t, uint8_t, uint8_t)':
input/code.cpp:65:11: warning: unused variable 'found' [-Wunused-variable]
65 | int found = -1;
| ^~~~~Code
#include <bits/stdc++.h>
using namespace std;
#define row bitset<250>
#define uin uint8_t
static int h, w, qc;
static std::array<std::bitset<250>, 250> xopt, yopt;
inline bool doShare(row &s1, row &s2) {
row sr = s1 & s2;
return sr.count();
}
struct ivec2 {
uin x, y = 0;
ivec2(int x, int y) : x(x), y(y) {}
ivec2() {}
ivec2 operator+(const ivec2 &other) const {
return ivec2(x + other.x, y + other.y);
}
ivec2 operator*(const int &value) const {
return ivec2(x * value, y * value);
}
ivec2 operator/(const int &value) const {
return ivec2(x / value, y / value);
}
friend std::ostream &operator<<(std::ostream &os, const ivec2 &v) {
return os << "(" << v.x << ", " << v.y << ")";
}
bool operator<(const ivec2 &other) const {
return (x < other.x) || (x == other.x && y < other.y);
}
bool operator>(const ivec2 &other) const {
return (x > other.x) || (x == other.x && y > other.y);
}
bool operator<=(const ivec2 &other) const {
return *this < other || *this == other;
}
bool operator>=(const ivec2 &other) const {
return *this > other || *this == other;
}
bool operator==(const ivec2 &other) const {
return (x == other.x && y == other.y) ? true : false;
}
};
inline uint16_t getIndex(uint16_t x, uint16_t y) { return y * w + x; }
inline ivec2 getCoords(uint16_t index) { return ivec2(index % w, index / w); }
int solveslow(uin sx, uin sy, uin dx, uin dy) {
std::vector<uint8_t> vx,
vy; /// this isn't going to be any faster than the prev one, is it?
std::vector<uint16_t> nindices; // step and pos
std::vector<uint16_t> cindices;
nindices.push_back(getIndex(dx, dy));
int step = 1;
while (!nindices.empty()) {
std::swap(nindices,cindices);
for (auto po : cindices) {
int found = -1;
ivec2 p = getCoords(po);
for (int fi = 0; fi < 250; fi++) {
if (xopt[p.y][fi]) {
if (yopt[fi][sy])
return step + 2;
nindices.push_back(getIndex(fi, p.y));
}
if (yopt[p.x][fi]) {
if (xopt[fi][sx])
return step + 2;
nindices.push_back(getIndex(p.x,fi));
}
}
// yopt.erase(p.x);
vx.push_back(p.x);
vy.push_back(p.y);
}
cindices.clear();
step++;
}
return -1;
}
int solve(int sx, int sy, int dx, int dy) {
if (dx == sx && dy == sy)
return 0;
else if (dx == sx || dy == sy)
return 1;
if (xopt[sy].count() == 1 && yopt[sx].count() == 1)
return -1;
if (yopt[dx].count() == 1 && xopt[dy].count() == 1)
return -1;
if (yopt[sx][dy])
return 2;
if (xopt[sy][dx])
return 2;
for (int fi = 0; fi < 250; fi++) {
if (xopt[sy][fi]) {
if (yopt[fi][dy])
return 3;
}
if (yopt[sx][fi]) {
if (xopt[fi][dx])
return 3;
}
}
return -1;
}
int main() {
std::ios_base::sync_with_stdio(false);
std::cin.tie(NULL);
cin >> h >> w >> qc;
string line;
getline(cin, line);
for (int y = 0; y < h && std::getline(cin, line); y++) {
if (line.size() == 0)
continue;
for (int x = 0; x < w; x++) {
if (line[x] == 46) {
xopt[y][x] = 1;
yopt[x][y] = 1;
}
}
}
int sx, sy, dx, dy;
for (int i = 0; i < qc; i++) {
cin >> sy >> sx >> dy >> dx;
sx--;
sy--;
dx--;
dy--;
std::cout << solve(sx, sy, dx, dy) << "\n";
}
}
Test details
Test 1 (public)
Group: 1, 2, 3, 4, 5
Verdict: ACCEPTED
| input |
|---|
| 4 6 5 .*.*** *...** *****. *..*.* ... |
| correct output |
|---|
| 1 0 3 3 -1 |
| user output |
|---|
| 1 0 3 3 -1 |
Test 2
Group: 1, 2, 3, 4, 5
Verdict: ACCEPTED
| input |
|---|
| 10 10 10 .......... .....*.... ........*. *.*....*.. ... |
| correct output |
|---|
| 1 2 1 2 2 ... |
| user output |
|---|
| 1 2 1 2 2 ... |
Test 3
Group: 1, 2, 3, 4, 5
Verdict: ACCEPTED
| input |
|---|
| 10 10 10 *...***.** *****.*... **..**.**. ..**.**.*. ... |
| correct output |
|---|
| 1 2 2 1 2 ... |
| user output |
|---|
| 1 2 2 1 2 ... |
Test 4
Group: 1, 2, 3, 4, 5
Verdict: WRONG ANSWER
| input |
|---|
| 10 10 10 ***.*.**** ********** *.******** .*.***.**. ... |
| correct output |
|---|
| 3 4 2 3 4 ... |
| user output |
|---|
| 3 -1 2 3 -1 ... |
Feedback: Incorrect character on line 2 col 1: expected "4", got "-1"
Test 5
Group: 1, 2, 3, 4, 5
Verdict: WRONG ANSWER
| input |
|---|
| 10 10 1 .****.**** **.**..*** ********** *******..* ... |
| correct output |
|---|
| 7 |
| user output |
|---|
| -1 |
Feedback: Incorrect character on line 1 col 1: expected "7", got "-1"
Test 6
Group: 2, 5
Verdict: ACCEPTED
| input |
|---|
| 250 250 250 .*...*.....*******..**...*....... |
| correct output |
|---|
| 2 3 3 2 2 ... |
| user output |
|---|
| 2 3 3 2 2 ... |
Test 7
Group: 2, 5
Verdict: ACCEPTED
| input |
|---|
| 250 250 250 ...*......**.**.*.*..**..*..**... |
| correct output |
|---|
| 2 2 2 2 3 ... |
| user output |
|---|
| 2 2 2 2 3 ... |
Test 8
Group: 2, 5
Verdict: ACCEPTED
| input |
|---|
| 250 250 250 **..**..****.****.*.***.***..*... |
| correct output |
|---|
| 2 3 3 3 3 ... |
| user output |
|---|
| 2 3 3 3 3 ... |
Test 9
Group: 3, 4, 5
Verdict: ACCEPTED
| input |
|---|
| 40 40 200000 ...*.**.*..*.............*.*..... |
| correct output |
|---|
| 2 2 2 2 2 ... |
| user output |
|---|
| 2 2 2 2 2 ... |
Test 10
Group: 3, 4, 5
Verdict: ACCEPTED
| input |
|---|
| 40 40 200000 **.**..*.*.*.******....****.*.... |
| correct output |
|---|
| 2 1 3 2 2 ... |
| user output |
|---|
| 2 1 3 2 2 ... |
Test 11
Group: 3, 4, 5
Verdict: WRONG ANSWER
| input |
|---|
| 40 40 200000 .*.*.**.*****.***.*.****.**.**... |
| correct output |
|---|
| 3 3 3 3 3 ... |
| user output |
|---|
| 3 3 3 3 3 ... |
Feedback: Incorrect character on line 75 col 1: expected "4", got "-1"
Test 12
Group: 4, 5
Verdict: ACCEPTED
| input |
|---|
| 80 80 200000 *....**.***..****...*.....*...... |
| correct output |
|---|
| 2 2 2 2 2 ... |
| user output |
|---|
| 2 2 2 2 2 ... |
Test 13
Group: 4, 5
Verdict: ACCEPTED
| input |
|---|
| 80 80 200000 .***.*..*.***..*****....**...*... |
| correct output |
|---|
| 3 2 2 3 2 ... |
| user output |
|---|
| 3 2 2 3 2 ... |
Test 14
Group: 4, 5
Verdict: WRONG ANSWER
| input |
|---|
| 80 80 200000 *******.*****.*..*..****...***... |
| correct output |
|---|
| 2 3 1 2 2 ... |
| user output |
|---|
| 2 3 1 2 2 ... |
Feedback: Incorrect character on line 82466 col 1: expected "4", got "-1"
Test 15
Group: 5
Verdict: ACCEPTED
| input |
|---|
| 250 250 200000 *....*..*..*..**..*.........**... |
| correct output |
|---|
| 3 2 2 2 2 ... |
| user output |
|---|
| 3 2 2 2 2 ... |
Test 16
Group: 5
Verdict: ACCEPTED
| input |
|---|
| 250 250 200000 ..*....*..*......*.**.*.*..***... |
| correct output |
|---|
| 2 2 2 2 2 ... |
| user output |
|---|
| 2 2 2 2 2 ... |
Test 17
Group: 5
Verdict: ACCEPTED
| input |
|---|
| 250 250 200000 *..*.*****.*********.****.****... |
| correct output |
|---|
| 3 3 2 2 2 ... |
| user output |
|---|
| 3 3 2 2 2 ... |
Test 18
Group: 5
Verdict: WRONG ANSWER
| input |
|---|
| 250 250 200000 *********.**********.******.**... |
| correct output |
|---|
| 3 3 3 3 3 ... |
| user output |
|---|
| 3 3 3 3 3 ... |
Feedback: Incorrect character on line 441 col 1: expected "4", got "-1"
Test 19
Group: 5
Verdict: WRONG ANSWER
| input |
|---|
| 250 250 200000 .*****************************... |
| correct output |
|---|
| 104 422 145 93 65 ... |
| user output |
|---|
| -1 -1 -1 -1 -1 ... |
Feedback: Incorrect character on line 1 col 1: expected "104", got "-1"
Test 20
Group: 5
Verdict: WRONG ANSWER
| input |
|---|
| 250 250 200000 ..****************************... |
| correct output |
|---|
| 57 155 38 65 98 ... |
| user output |
|---|
| -1 -1 -1 -1 -1 ... |
Feedback: Incorrect character on line 1 col 1: expected "57", got "-1"
Test 21
Group: 5
Verdict: WRONG ANSWER
| input |
|---|
| 250 250 200000 .*****************************... |
| correct output |
|---|
| 498 498 498 498 498 ... |
| user output |
|---|
| -1 -1 -1 -1 -1 ... |
Feedback: Incorrect character on line 1 col 1: expected "498", got "-1"
Test 22
Group: 1, 2, 3, 4, 5
Verdict: ACCEPTED
| input |
|---|
| 10 1 10 * * . * ... |
| correct output |
|---|
| 0 1 1 0 0 ... |
| user output |
|---|
| 0 1 1 0 0 ... |
Test 23
Group: 1, 2, 3, 4, 5
Verdict: ACCEPTED
| 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 |
|---|
| 1 1 1 1 1 ... |
Test 24
Group: 5
Verdict: ACCEPTED
| input |
|---|
| 250 1 200000 * . * . ... |
| correct output |
|---|
| 1 1 1 1 1 ... |
| user output |
|---|
| 1 1 1 1 1 ... |
Test 25
Group: 5
Verdict: ACCEPTED
| input |
|---|
| 1 250 200000 *.*.*...*.*.**.***..**.*.*..**... |
| correct output |
|---|
| 1 1 1 1 1 ... |
| user output |
|---|
| 1 1 1 1 1 ... |
Test 26
Group: 5
Verdict: ACCEPTED
| input |
|---|
| 250 250 200000 ................................. |
| correct output |
|---|
| 2 2 2 2 2 ... |
| user output |
|---|
| 2 2 2 2 2 ... |
Test 27
Group: 5
Verdict: ACCEPTED
| input |
|---|
| 250 250 200000 ******************************... |
| correct output |
|---|
| 0 0 0 0 0 ... |
| user output |
|---|
| 0 0 0 0 0 ... |
