| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "kondakov_v_min_val_in_matrix_str/seq/include/ops_seq.hpp" | ||
| 2 | |||
| 3 | #include <algorithm> | ||
| 4 | #include <cstddef> | ||
| 5 | #include <limits> | ||
| 6 | #include <vector> | ||
| 7 | |||
| 8 | #include "kondakov_v_min_val_in_matrix_str/common/include/common.hpp" | ||
| 9 | |||
| 10 | namespace kondakov_v_min_val_in_matrix_str { | ||
| 11 | |||
| 12 |
1/2✓ Branch 1 taken 40 times.
✗ Branch 2 not taken.
|
40 | KondakovVMinValMatrixSEQ::KondakovVMinValMatrixSEQ(const InType &in) { |
| 13 | SetTypeOfTask(GetStaticTypeOfTask()); | ||
| 14 |
1/2✓ Branch 1 taken 40 times.
✗ Branch 2 not taken.
|
40 | InType tmp = in; |
| 15 | GetInput().swap(tmp); | ||
| 16 | GetOutput().clear(); | ||
| 17 |
1/2✓ Branch 1 taken 40 times.
✗ Branch 2 not taken.
|
40 | GetOutput().resize(in.size()); |
| 18 | 40 | } | |
| 19 | |||
| 20 |
2/2✓ Branch 0 taken 32 times.
✓ Branch 1 taken 8 times.
|
40 | bool KondakovVMinValMatrixSEQ::ValidationImpl() { |
| 21 | const auto &matrix = GetInput(); | ||
| 22 |
2/2✓ Branch 0 taken 32 times.
✓ Branch 1 taken 8 times.
|
40 | if (matrix.empty()) { |
| 23 | return true; | ||
| 24 | } | ||
| 25 | |||
| 26 | size_t cols = matrix[0].size(); | ||
| 27 |
2/4✓ Branch 0 taken 56 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 56 times.
✗ Branch 3 not taken.
|
56 | return std::ranges::all_of(matrix, [cols](const auto &row) { return !row.empty() && row.size() == cols; }); |
| 28 | } | ||
| 29 | 40 | bool KondakovVMinValMatrixSEQ::PreProcessingImpl() { | |
| 30 | 40 | return true; | |
| 31 | } | ||
| 32 | |||
| 33 | 40 | bool KondakovVMinValMatrixSEQ::RunImpl() { | |
| 34 | const auto &matrix = GetInput(); | ||
| 35 | auto &output = GetOutput(); | ||
| 36 | |||
| 37 |
2/2✓ Branch 0 taken 56 times.
✓ Branch 1 taken 40 times.
|
96 | for (size_t i = 0; i < matrix.size(); ++i) { |
| 38 | 56 | int min_val = std::numeric_limits<int>::max(); | |
| 39 |
2/2✓ Branch 0 taken 152 times.
✓ Branch 1 taken 56 times.
|
208 | for (int val : matrix[i]) { |
| 40 | 152 | min_val = std::min(min_val, val); | |
| 41 | } | ||
| 42 | 56 | output[i] = min_val; | |
| 43 | } | ||
| 44 | |||
| 45 | 40 | return true; | |
| 46 | } | ||
| 47 | |||
| 48 | 40 | bool KondakovVMinValMatrixSEQ::PostProcessingImpl() { | |
| 49 | 40 | return true; | |
| 50 | } | ||
| 51 | |||
| 52 | } // namespace kondakov_v_min_val_in_matrix_str | ||
| 53 |