Submission details
Task:Hypyt
Sender:lukarantalainen
Submission time:2026-07-04 16:26:03 +0300
Language:C++ (C++20)
Status:READY
Result:0
Feedback
subtaskverdictscore
#10
#20
#30
#40
#50
Test results
testverdicttimesubtask
#10.00 s1, 2, 3, 4, 5details
#20.00 s1, 2, 3, 4, 5details
#30.00 s1, 2, 3, 4, 5details
#40.00 s1, 2, 3, 4, 5details
#50.00 s1, 2, 3, 4, 5details
#60.01 s2, 5details
#70.01 s2, 5details
#80.01 s2, 5details
#90.14 s3, 4, 5details
#100.15 s3, 4, 5details
#110.13 s3, 4, 5details
#120.22 s4, 5details
#130.27 s4, 5details
#140.22 s4, 5details
#150.54 s5details
#160.73 s5details
#170.58 s5details
#180.38 s5details
#190.23 s5details
#200.23 s5details
#210.21 s5details
#22ACCEPTED0.00 s1, 2, 3, 4, 5details
#23ACCEPTED0.00 s1, 2, 3, 4, 5details
#24ACCEPTED0.08 s5details
#25ACCEPTED0.08 s5details
#260.20 s5details
#27ACCEPTED0.09 s5details

Compiler report

In file included from /usr/include/c++/13/cassert:44,
                 from input/code.cpp:5:
input/code.cpp: In function 'int main()':
input/code.cpp:30:22: warning: comparison of integer expressions of different signedness: 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   30 |   assert(grid.size() == n && grid[0].size() == m);
      |          ~~~~~~~~~~~~^~~~
input/code.cpp:30:45: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   30 |   assert(grid.size() == n && grid[0].size() == m);
      |                              ~~~~~~~~~~~~~~~^~~~
input/code.cpp:37:9: warning: unused variable 'count' [-Wunused-variable]
   37 |     int count{};
      |         ^~~~~

Code

#include <iostream>
#include <vector>
#include <string>
#include <fstream>
#include <cassert>

using namespace std;

struct Point {
  int x;
  int y;
};

int main() {
  iostream::ios_base::sync_with_stdio(0);
  cin.tie(0);


  int n, m, q;
  cin >> n >> m >> q;

  std::vector<std::string> grid;
  for (int i{}; i < n; ++i) {
    std::string line;
    std::cin.ignore();
    std::getline(std::cin, line);
    grid.push_back(line);
  }

  assert(grid.size() == n && grid[0].size() == m);

  for (int i{}; i < q; ++i) {
    Point a;
    Point b;
    std::cin >> a.y >> a.x >> b.y >> b.x;

    int count{};

    if (a.x == b.x && a.y == b.y) {
      std::cout << 0 << "\n";
      continue;
    }

    if (a.x == b.x || a.y == b.y) {
      std::cout << 1 << "\n";
      continue;
    }

    bool impossible{true};
    for (int row{}; row < n; ++row) {
      if (grid[row][a.x-1] != '*' && row != a.y-1) impossible = false;
    }

    for (int col{}; col < m; ++col) {
      if (grid[a.y-1][col] != '*' && col != a.x-1) impossible = false;
    }

    if (impossible) {
      std::cout << -1 << "\n";
      continue;
    }

    std::cout << 3 << "\n";
  }


  return 0;
}

Test details

Test 1 (public)

Subtask: 1, 2, 3, 4, 5

Verdict:

input
4 6 5
.*.***
*...**
*****.
*..*.*
...

correct output
1
0
3
3
-1

user output
1
0
3
3
3

Feedback: Incorrect character on line 5 col 1: expected "-1", got "3"

Test 2

Subtask: 1, 2, 3, 4, 5

Verdict:

input
10 10 10
..........
.....*....
........*.
*.*....*..
...

correct output
1
2
1
2
2
...

user output
1
3
1
3
3
...

Feedback: Incorrect character on line 2 col 1: expected "2", got "3"

Test 3

Subtask: 1, 2, 3, 4, 5

Verdict:

input
10 10 10
*...***.**
*****.*...
**..**.**.
..**.**.*.
...

correct output
1
2
2
1
2
...

user output
1
3
3
1
3
...

Feedback: Incorrect character on line 2 col 1: expected "2", got "3"

Test 4

Subtask: 1, 2, 3, 4, 5

Verdict:

input
10 10 10
***.*.****
**********
*.********
.*.***.**.
...

correct output
3
4
2
3
4
...

user output
3
3
3
3
3
...

Feedback: Incorrect character on line 2 col 1: expected "4", got "3"

Test 5

Subtask: 1, 2, 3, 4, 5

Verdict:

input
10 10 1
.****.****
**.**..***
**********
*******..*
...

correct output
7

user output
3

Feedback: Incorrect character on line 1 col 1: expected "7", got "3"

Test 6

Subtask: 2, 5

Verdict:

input
250 250 250
.*...*.....*******..**...*.......

correct output
2
3
3
2
2
...

user output
3
3
3
3
3
...

Feedback: Incorrect character on line 1 col 1: expected "2", got "3"

Test 7

Subtask: 2, 5

Verdict:

input
250 250 250
...*......**.**.*.*..**..*..**...

correct output
2
2
2
2
3
...

user output
3
3
3
3
3
...

Feedback: Incorrect character on line 1 col 1: expected "2", got "3"

Test 8

Subtask: 2, 5

Verdict:

input
250 250 250
**..**..****.****.*.***.***..*...

correct output
2
3
3
3
3
...

user output
3
3
3
3
3
...

Feedback: Incorrect character on line 1 col 1: expected "2", got "3"

Test 9

Subtask: 3, 4, 5

Verdict:

input
40 40 200000
...*.**.*..*.............*.*.....

correct output
2
2
2
2
2
...

user output
3
3
3
3
3
...

Feedback: Incorrect character on line 1 col 1: expected "2", got "3"

Test 10

Subtask: 3, 4, 5

Verdict:

input
40 40 200000
**.**..*.*.*.******....****.*....

correct output
2
1
3
2
2
...

user output
3
1
3
3
3
...

Feedback: Incorrect character on line 1 col 1: expected "2", got "3"

Test 11

Subtask: 3, 4, 5

Verdict:

input
40 40 200000
.*.*.**.*****.***.*.****.**.**...

correct output
3
3
3
3
3
...

user output
3
3
3
3
3
...

Feedback: Incorrect character on line 9 col 1: expected "2", got "3"

Test 12

Subtask: 4, 5

Verdict:

input
80 80 200000
*....**.***..****...*.....*......

correct output
2
2
2
2
2
...

user output
3
3
3
3
3
...

Feedback: Incorrect character on line 1 col 1: expected "2", got "3"

Test 13

Subtask: 4, 5

Verdict:

input
80 80 200000
.***.*..*.***..*****....**...*...

correct output
3
2
2
3
2
...

user output
3
3
3
3
3
...

Feedback: Incorrect character on line 2 col 1: expected "2", got "3"

Test 14

Subtask: 4, 5

Verdict:

input
80 80 200000
*******.*****.*..*..****...***...

correct output
2
3
1
2
2
...

user output
3
3
1
3
3
...

Feedback: Incorrect character on line 1 col 1: expected "2", got "3"

Test 15

Subtask: 5

Verdict:

input
250 250 200000
*....*..*..*..**..*.........**...

correct output
3
2
2
2
2
...

user output
3
3
3
3
3
...

Feedback: Incorrect character on line 2 col 1: expected "2", got "3"

Test 16

Subtask: 5

Verdict:

input
250 250 200000
..*....*..*......*.**.*.*..***...

correct output
2
2
2
2
2
...

user output
3
3
3
3
3
...

Feedback: Incorrect character on line 1 col 1: expected "2", got "3"

Test 17

Subtask: 5

Verdict:

input
250 250 200000
*..*.*****.*********.****.****...

correct output
3
3
2
2
2
...

user output
3
3
3
3
3
...

Feedback: Incorrect character on line 3 col 1: expected "2", got "3"

Test 18

Subtask: 5

Verdict:

input
250 250 200000
*********.**********.******.**...

correct output
3
3
3
3
3
...

user output
3
3
3
3
3
...

Feedback: Incorrect character on line 8 col 1: expected "2", got "3"

Test 19

Subtask: 5

Verdict:

input
250 250 200000
.*****************************...

correct output
104
422
145
93
65
...

user output
3
3
3
3
3
...

Feedback: Incorrect character on line 1 col 1: expected "104", got "3"

Test 20

Subtask: 5

Verdict:

input
250 250 200000
..****************************...

correct output
57
155
38
65
98
...

user output
3
3
3
3
3
...

Feedback: Incorrect character on line 1 col 1: expected "57", got "3"

Test 21

Subtask: 5

Verdict:

input
250 250 200000
.*****************************...

correct output
498
498
498
498
498
...

user output
3
3
3
3
3
...

Feedback: Incorrect character on line 1 col 1: expected "498", got "3"

Test 22

Subtask: 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

Subtask: 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

Subtask: 5

Verdict: ACCEPTED

input
250 1 200000
*
.
*
.
...

correct output
1
1
1
1
1
...

user output
1
1
1
1
1
...

Test 25

Subtask: 5

Verdict: ACCEPTED

input
1 250 200000
*.*.*...*.*.**.***..**.*.*..**...

correct output
1
1
1
1
1
...

user output
1
1
1
1
1
...

Test 26

Subtask: 5

Verdict:

input
250 250 200000
.................................

correct output
2
2
2
2
2
...

user output
3
3
3
3
3
...

Feedback: Incorrect character on line 1 col 1: expected "2", got "3"

Test 27

Subtask: 5

Verdict: ACCEPTED

input
250 250 200000
******************************...

correct output
0
0
0
0
0
...

user output
0
0
0
0
0
...