| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "kapanova_s_min_of_matrix_elements/seq/include/ops_seq.hpp" | ||
| 2 | |||
| 3 | #include <algorithm> // Добавлено для std::min и std::ranges::all_of | ||
| 4 | #include <climits> | ||
| 5 | #include <cstddef> | ||
| 6 | #include <vector> | ||
| 7 | |||
| 8 | #include "kapanova_s_min_of_matrix_elements/common/include/common.hpp" | ||
| 9 | |||
| 10 | namespace kapanova_s_min_of_matrix_elements { | ||
| 11 | |||
| 12 |
1/2✓ Branch 1 taken 80 times.
✗ Branch 2 not taken.
|
80 | KapanovaSMinOfMatrixElementsSEQ::KapanovaSMinOfMatrixElementsSEQ(const InType &in) { |
| 13 | SetTypeOfTask(GetStaticTypeOfTask()); | ||
| 14 |
1/2✓ Branch 1 taken 80 times.
✗ Branch 2 not taken.
|
80 | GetInput().resize(in.size()); |
| 15 |
2/2✓ Branch 0 taken 168 times.
✓ Branch 1 taken 80 times.
|
248 | for (size_t i = 0; i < in.size(); ++i) { |
| 16 |
1/2✓ Branch 1 taken 168 times.
✗ Branch 2 not taken.
|
168 | GetInput()[i] = in[i]; |
| 17 | } | ||
| 18 | 80 | GetOutput() = 0; | |
| 19 | 80 | } | |
| 20 | |||
| 21 |
2/2✓ Branch 0 taken 72 times.
✓ Branch 1 taken 8 times.
|
80 | bool KapanovaSMinOfMatrixElementsSEQ::ValidationImpl() { |
| 22 | const auto &matrix = GetInput(); | ||
| 23 |
2/2✓ Branch 0 taken 72 times.
✓ Branch 1 taken 8 times.
|
80 | if (matrix.empty()) { |
| 24 | return true; | ||
| 25 | } | ||
| 26 | |||
| 27 | const size_t cols = matrix[0].size(); | ||
| 28 | return std::ranges::all_of(matrix, [cols](const auto &row) { return row.size() == cols; }); | ||
| 29 | } | ||
| 30 | |||
| 31 | 80 | bool KapanovaSMinOfMatrixElementsSEQ::PreProcessingImpl() { | |
| 32 | 80 | GetOutput() = INT_MAX; | |
| 33 | 80 | return true; | |
| 34 | } | ||
| 35 | |||
| 36 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 72 times.
|
80 | bool KapanovaSMinOfMatrixElementsSEQ::RunImpl() { |
| 37 | const auto &matrix = GetInput(); | ||
| 38 | |||
| 39 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 72 times.
|
80 | if (matrix.empty()) { |
| 40 | 8 | GetOutput() = INT_MAX; | |
| 41 | 8 | return true; | |
| 42 | } | ||
| 43 | |||
| 44 | 72 | int min_value = INT_MAX; | |
| 45 |
2/2✓ Branch 0 taken 168 times.
✓ Branch 1 taken 72 times.
|
240 | for (const auto &row : matrix) { |
| 46 |
2/2✓ Branch 0 taken 400 times.
✓ Branch 1 taken 168 times.
|
568 | for (const int value : row) { |
| 47 | 400 | min_value = std::min(value, min_value); | |
| 48 | } | ||
| 49 | } | ||
| 50 | |||
| 51 | 72 | GetOutput() = min_value; | |
| 52 | 72 | return true; | |
| 53 | } | ||
| 54 | |||
| 55 | 80 | bool KapanovaSMinOfMatrixElementsSEQ::PostProcessingImpl() { | |
| 56 | 80 | return true; | |
| 57 | } | ||
| 58 | |||
| 59 | } // namespace kapanova_s_min_of_matrix_elements | ||
| 60 |