| Task: | Hypyt |
| Sender: | zli0122 |
| Submission time: | 2025-11-02 22:32:34 +0200 |
| Language: | C++ (C++11) |
| 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.01 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.40 s | 2, 5 | details |
| #7 | WRONG ANSWER | 0.34 s | 2, 5 | details |
| #8 | WRONG ANSWER | 0.29 s | 2, 5 | details |
| #9 | WRONG ANSWER | 0.16 s | 3, 4, 5 | details |
| #10 | WRONG ANSWER | 0.14 s | 3, 4, 5 | details |
| #11 | WRONG ANSWER | 0.12 s | 3, 4, 5 | details |
| #12 | WRONG ANSWER | 0.34 s | 4, 5 | details |
| #13 | WRONG ANSWER | 0.25 s | 4, 5 | details |
| #14 | WRONG ANSWER | 0.17 s | 4, 5 | details |
| #15 | TIME LIMIT EXCEEDED | -- | 5 | details |
| #16 | TIME LIMIT EXCEEDED | -- | 5 | details |
| #17 | WRONG ANSWER | 0.85 s | 5 | details |
| #18 | WRONG ANSWER | 0.59 s | 5 | details |
| #19 | WRONG ANSWER | 0.13 s | 5 | details |
| #20 | WRONG ANSWER | 0.14 s | 5 | details |
| #21 | WRONG ANSWER | 0.11 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.11 s | 5 | details |
| #25 | WRONG ANSWER | 0.08 s | 5 | details |
| #26 | TIME LIMIT EXCEEDED | -- | 5 | details |
| #27 | WRONG ANSWER | 0.10 s | 5 | details |
Code
#include<bits/stdc++.h>
using namespace std;
#define debug(x) cout << #x << ": " << (x) << " | "
#define Debug(x) cout << #x << ": " << (x) << "\n"
const int N = 250;
const int M = 250;
int grid[N][M];
bool vis[N][N];
int dis[N][N];
void solve() {
int n, m, q;
cin >> n >> m >> q;
unordered_set<int> adj[N];
unordered_set<int> col_connections[M];
char t;
for (int r=0; r<n; r++) {
for (int c=0; c<m; c++) {
cin >> t;
if (t == '.') {
grid[r][c]=1;
for (auto i : col_connections[c]) {
adj[i].insert(r);
adj[r].insert(i);
}
col_connections[c].insert(r);
}
}
}
queue<int> dfs;
for (int r=0; r<n; r++) {
vis[r][r] = true;
dis[r][r] = 0;
dfs.push(r);
while (!dfs.empty()) {
int s = dfs.front(); dfs.pop();
for (auto u : adj[s]) {
if (vis[r][u]) continue;
vis[r][u] = true;
dis[r][u] = dis[r][s]+1;
dfs.push(u);
}
}
}
for (int r=0;r<n;r++) {
for (int c=0;c<m;c++) {
cout << r << c << ": " << dis[r][c] << ", ";
}
cout << "\n";
}
int r1, c1, r2, c2;
int ans;
unordered_set<int> first_vertical, last_vertical;
for (int _=0;_<q;_++) {
first_vertical.clear();
last_vertical.clear();
cin >> r1 >> c1 >> r2 >> c2;
r1--; c1--; r2--; c2--;
if (!vis[r1][r2]) {cout << -1 << "\n"; continue;}
if (r1 == r2 && c1 == c2) {cout << 0 << "\n"; continue;}
if (r1 == r2 || c1 == c2) {cout << 1 << "\n"; continue;}
ans = 2*dis[r1][r2]+1; // hv...vh
for (auto i : col_connections[c1])
if (dis[i][r2] < dis[r1][r2]) {first_vertical.insert(i);}
for (auto j : col_connections[c2])
if (dis[r1][j] < dis[r1][r2]) {last_vertical.insert(j);}
bool done = 0;
if ((!first_vertical.empty()) || (!last_vertical.empty())) ans--;
if ((!first_vertical.empty()) && (!last_vertical.empty())) {
for (auto i : first_vertical) {
for (auto j : last_vertical) {
if (dis[i][j] == dis[r1][r2]-2) {
ans--;
done = 1;
break;
}
}
if ( done ) break;
}
}
cout << ans << "\n";
}
}
int main () {
cin.tie(0) -> ios::sync_with_stdio(0);
solve();
}
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 |
|---|
| 00: 0, 01: 1, 02: 0, 03: 1, 04... |
Feedback: Output is longer 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 |
|---|
| 00: 0, 01: 1, 02: 1, 03: 1, 04... |
Feedback: Output is longer 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 |
|---|
| 00: 0, 01: 1, 02: 1, 03: 1, 04... |
Feedback: Output is longer 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 |
|---|
| 00: 0, 01: 0, 02: 3, 03: 2, 04... |
Feedback: Output is longer than expected
Test 5
Group: 1, 2, 3, 4, 5
Verdict: WRONG ANSWER
| input |
|---|
| 10 10 1 .****.**** **.**..*** ********** *******..* ... |
| correct output |
|---|
| 7 |
| user output |
|---|
| 00: 0, 01: 1, 02: 0, 03: 2, 04... |
Feedback: Output is longer than expected
Test 6
Group: 2, 5
Verdict: WRONG ANSWER
| input |
|---|
| 250 250 250 .*...*.....*******..**...*....... |
| correct output |
|---|
| 2 3 3 2 2 ... |
| user output |
|---|
| 00: 0, 01: 1, 02: 1, 03: 1, 04... |
Feedback: Output is longer than expected
Test 7
Group: 2, 5
Verdict: WRONG ANSWER
| input |
|---|
| 250 250 250 ...*......**.**.*.*..**..*..**... |
| correct output |
|---|
| 2 2 2 2 3 ... |
| user output |
|---|
| 00: 0, 01: 1, 02: 1, 03: 1, 04... |
Feedback: Output is longer than expected
Test 8
Group: 2, 5
Verdict: WRONG ANSWER
| input |
|---|
| 250 250 250 **..**..****.****.*.***.***..*... |
| correct output |
|---|
| 2 3 3 3 3 ... |
| user output |
|---|
| 00: 0, 01: 1, 02: 1, 03: 1, 04... |
Feedback: Output is longer than expected
Test 9
Group: 3, 4, 5
Verdict: WRONG ANSWER
| input |
|---|
| 40 40 200000 ...*.**.*..*.............*.*..... |
| correct output |
|---|
| 2 2 2 2 2 ... |
| user output |
|---|
| 00: 0, 01: 1, 02: 1, 03: 1, 04... |
Feedback: Output is longer than expected
Test 10
Group: 3, 4, 5
Verdict: WRONG ANSWER
| input |
|---|
| 40 40 200000 **.**..*.*.*.******....****.*.... |
| correct output |
|---|
| 2 1 3 2 2 ... |
| user output |
|---|
| 00: 0, 01: 1, 02: 1, 03: 1, 04... |
Feedback: Output is longer than expected
Test 11
Group: 3, 4, 5
Verdict: WRONG ANSWER
| input |
|---|
| 40 40 200000 .*.*.**.*****.***.*.****.**.**... |
| correct output |
|---|
| 3 3 3 3 3 ... |
| user output |
|---|
| 00: 0, 01: 1, 02: 1, 03: 1, 04... |
Feedback: Output is longer than expected
Test 12
Group: 4, 5
Verdict: WRONG ANSWER
| input |
|---|
| 80 80 200000 *....**.***..****...*.....*...... |
| correct output |
|---|
| 2 2 2 2 2 ... |
| user output |
|---|
| 00: 0, 01: 1, 02: 1, 03: 1, 04... |
Feedback: Output is longer than expected
Test 13
Group: 4, 5
Verdict: WRONG ANSWER
| input |
|---|
| 80 80 200000 .***.*..*.***..*****....**...*... |
| correct output |
|---|
| 3 2 2 3 2 ... |
| user output |
|---|
| 00: 0, 01: 1, 02: 1, 03: 1, 04... |
Feedback: Output is longer than expected
Test 14
Group: 4, 5
Verdict: WRONG ANSWER
| input |
|---|
| 80 80 200000 *******.*****.*..*..****...***... |
| correct output |
|---|
| 2 3 1 2 2 ... |
| user output |
|---|
| 00: 0, 01: 1, 02: 1, 03: 1, 04... |
Feedback: Output is longer than expected
Test 15
Group: 5
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 250 250 200000 *....*..*..*..**..*.........**... |
| correct output |
|---|
| 3 2 2 2 2 ... |
| user output |
|---|
| (empty) |
Test 16
Group: 5
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 250 250 200000 ..*....*..*......*.**.*.*..***... |
| correct output |
|---|
| 2 2 2 2 2 ... |
| user output |
|---|
| (empty) |
Test 17
Group: 5
Verdict: WRONG ANSWER
| input |
|---|
| 250 250 200000 *..*.*****.*********.****.****... |
| correct output |
|---|
| 3 3 2 2 2 ... |
| user output |
|---|
| 00: 0, 01: 1, 02: 1, 03: 1, 04... |
Feedback: Output is longer than expected
Test 18
Group: 5
Verdict: WRONG ANSWER
| input |
|---|
| 250 250 200000 *********.**********.******.**... |
| correct output |
|---|
| 3 3 3 3 3 ... |
| user output |
|---|
| 00: 0, 01: 1, 02: 1, 03: 1, 04... |
Feedback: Output is longer than expected
Test 19
Group: 5
Verdict: WRONG ANSWER
| input |
|---|
| 250 250 200000 .*****************************... |
| correct output |
|---|
| 104 422 145 93 65 ... |
| user output |
|---|
| 00: 0, 01: 2, 02: 4, 03: 6, 04... |
Feedback: Output is longer than expected
Test 20
Group: 5
Verdict: WRONG ANSWER
| input |
|---|
| 250 250 200000 ..****************************... |
| correct output |
|---|
| 57 155 38 65 98 ... |
| user output |
|---|
| 00: 0, 01: 1, 02: 2, 03: 2, 04... |
Feedback: Output is longer than expected
Test 21
Group: 5
Verdict: WRONG ANSWER
| input |
|---|
| 250 250 200000 .*****************************... |
| correct output |
|---|
| 498 498 498 498 498 ... |
| user output |
|---|
| 00: 0, 01: 1, 02: 2, 03: 3, 04... |
Feedback: Output is longer 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 |
|---|
| 00: 0, 10: 0, 20: 0, 30: 0, 40: 0, ... |
Feedback: Output is longer 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 |
|---|
| 00: 0, 01: 0, 02: 0, 03: 0, 04... |
Feedback: Output is longer than expected
Test 24
Group: 5
Verdict: WRONG ANSWER
| input |
|---|
| 250 1 200000 * . * . ... |
| correct output |
|---|
| 1 1 1 1 1 ... |
| user output |
|---|
| 00: 0, 10: 0, 20: 0, 30: 0, 40: 0, ... |
Feedback: Output is longer than expected
Test 25
Group: 5
Verdict: WRONG ANSWER
| input |
|---|
| 1 250 200000 *.*.*...*.*.**.***..**.*.*..**... |
| correct output |
|---|
| 1 1 1 1 1 ... |
| user output |
|---|
| 00: 0, 01: 0, 02: 0, 03: 0, 04... |
Feedback: Output is longer than expected
Test 26
Group: 5
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 250 250 200000 ................................. |
| correct output |
|---|
| 2 2 2 2 2 ... |
| user output |
|---|
| (empty) |
Test 27
Group: 5
Verdict: WRONG ANSWER
| input |
|---|
| 250 250 200000 ******************************... |
| correct output |
|---|
| 0 0 0 0 0 ... |
| user output |
|---|
| 00: 0, 01: 0, 02: 0, 03: 0, 04... |
Feedback: Output is longer than expected
