| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "Terekhov_D_Min_Column_Matrix/seq/include/ops_seq.hpp" | ||
| 2 | |||
| 3 | #include <algorithm> | ||
| 4 | #include <climits> | ||
| 5 | #include <cstddef> | ||
| 6 | #include <ranges> // IWYU pragma: keep | ||
| 7 | #include <vector> | ||
| 8 | |||
| 9 | #include "Terekhov_D_Min_Column_Matrix/common/include/common.hpp" | ||
| 10 | |||
| 11 | namespace terekhov_d_a_test_task_processes { | ||
| 12 | |||
| 13 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | TerekhovDTestTaskSEQ::TerekhovDTestTaskSEQ(const InType &in) { |
| 14 | SetTypeOfTask(GetStaticTypeOfTask()); | ||
| 15 | |||
| 16 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | if (!in.empty()) { |
| 17 |
1/2✓ Branch 1 taken 82 times.
✗ Branch 2 not taken.
|
82 | GetInput() = in; |
| 18 | } else { | ||
| 19 | ✗ | GetInput() = InType{}; | |
| 20 | } | ||
| 21 | |||
| 22 | 82 | GetOutput() = OutType{}; | |
| 23 | 82 | } | |
| 24 | |||
| 25 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | bool TerekhovDTestTaskSEQ::ValidationImpl() { |
| 26 | const auto &input = GetInput(); | ||
| 27 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | if (input.empty()) { |
| 28 | return false; | ||
| 29 | } | ||
| 30 | |||
| 31 | const std::size_t cols = input[0].size(); | ||
| 32 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | if (cols == 0) { |
| 33 | return false; | ||
| 34 | } | ||
| 35 | |||
| 36 | return std::ranges::all_of(input, [cols](const auto &row) { return row.size() == cols; }); | ||
| 37 | } | ||
| 38 | |||
| 39 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 82 times.
|
82 | bool TerekhovDTestTaskSEQ::PreProcessingImpl() { |
| 40 | GetOutput().clear(); | ||
| 41 | 82 | return true; | |
| 42 | } | ||
| 43 | |||
| 44 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 82 times.
|
82 | bool TerekhovDTestTaskSEQ::RunImpl() { |
| 45 | const auto &matrix = GetInput(); | ||
| 46 | auto &result = GetOutput(); | ||
| 47 | |||
| 48 | result.clear(); | ||
| 49 | |||
| 50 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | if (matrix.empty()) { |
| 51 | return false; | ||
| 52 | } | ||
| 53 | |||
| 54 | const std::size_t rows = matrix.size(); | ||
| 55 | const std::size_t cols = matrix[0].size(); | ||
| 56 | |||
| 57 | 82 | result.assign(cols, INT_MAX); | |
| 58 | |||
| 59 |
2/2✓ Branch 0 taken 188 times.
✓ Branch 1 taken 82 times.
|
270 | for (std::size_t i = 0; i < rows; ++i) { |
| 60 |
2/2✓ Branch 0 taken 364 times.
✓ Branch 1 taken 188 times.
|
552 | for (std::size_t j = 0; j < cols; ++j) { |
| 61 |
2/2✓ Branch 0 taken 104 times.
✓ Branch 1 taken 260 times.
|
364 | const int val = matrix[i][j]; |
| 62 | 364 | result[j] = std::min(val, result[j]); | |
| 63 | } | ||
| 64 | } | ||
| 65 | |||
| 66 | return true; | ||
| 67 | } | ||
| 68 | |||
| 69 | 82 | bool TerekhovDTestTaskSEQ::PostProcessingImpl() { | |
| 70 | 82 | return true; | |
| 71 | } | ||
| 72 | |||
| 73 | } // namespace terekhov_d_a_test_task_processes | ||
| 74 |