| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "chyokotov_min_val_by_columns/seq/include/ops_seq.hpp" | ||
| 2 | |||
| 3 | #include <algorithm> | ||
| 4 | #include <climits> | ||
| 5 | #include <cstddef> | ||
| 6 | #include <vector> | ||
| 7 | |||
| 8 | #include "chyokotov_min_val_by_columns/common/include/common.hpp" | ||
| 9 | |||
| 10 | namespace chyokotov_min_val_by_columns { | ||
| 11 | |||
| 12 |
1/2✓ Branch 1 taken 64 times.
✗ Branch 2 not taken.
|
64 | ChyokotovMinValByColumnsSEQ::ChyokotovMinValByColumnsSEQ(const InType &in) { |
| 13 | SetTypeOfTask(GetStaticTypeOfTask()); | ||
| 14 | GetInput().clear(); | ||
| 15 |
1/2✓ Branch 1 taken 64 times.
✗ Branch 2 not taken.
|
64 | GetInput().reserve(in.size()); |
| 16 |
2/2✓ Branch 0 taken 128 times.
✓ Branch 1 taken 64 times.
|
192 | for (const auto &row : in) { |
| 17 |
1/2✓ Branch 1 taken 128 times.
✗ Branch 2 not taken.
|
128 | GetInput().push_back(row); |
| 18 | } | ||
| 19 | |||
| 20 | GetOutput().clear(); | ||
| 21 | 64 | } | |
| 22 | |||
| 23 |
2/2✓ Branch 0 taken 56 times.
✓ Branch 1 taken 8 times.
|
64 | bool ChyokotovMinValByColumnsSEQ::ValidationImpl() { |
| 24 | const auto &input = GetInput(); | ||
| 25 |
2/2✓ Branch 0 taken 56 times.
✓ Branch 1 taken 8 times.
|
64 | if (input.empty()) { |
| 26 | return true; | ||
| 27 | } | ||
| 28 | |||
| 29 | size_t length_row = input[0].size(); | ||
| 30 | return std::ranges::all_of(input, [length_row](const auto &row) { return row.size() == length_row; }); | ||
| 31 | } | ||
| 32 | |||
| 33 |
2/2✓ Branch 0 taken 56 times.
✓ Branch 1 taken 8 times.
|
64 | bool ChyokotovMinValByColumnsSEQ::PreProcessingImpl() { |
| 34 |
2/2✓ Branch 0 taken 56 times.
✓ Branch 1 taken 8 times.
|
64 | if (GetInput().empty()) { |
| 35 | return true; | ||
| 36 | } | ||
| 37 | 56 | GetOutput().resize(GetInput()[0].size(), INT_MAX); | |
| 38 | 56 | return true; | |
| 39 | } | ||
| 40 | |||
| 41 |
2/2✓ Branch 0 taken 56 times.
✓ Branch 1 taken 8 times.
|
64 | bool ChyokotovMinValByColumnsSEQ::RunImpl() { |
| 42 | const auto &matrix = GetInput(); | ||
| 43 |
2/2✓ Branch 0 taken 56 times.
✓ Branch 1 taken 8 times.
|
64 | if (matrix.empty()) { |
| 44 | return true; | ||
| 45 | } | ||
| 46 | auto &output = GetOutput(); | ||
| 47 | |||
| 48 |
2/2✓ Branch 0 taken 144 times.
✓ Branch 1 taken 56 times.
|
200 | for (size_t i = 0; i < output.size(); i++) { |
| 49 |
2/2✓ Branch 0 taken 280 times.
✓ Branch 1 taken 144 times.
|
424 | for (const auto &row : matrix) { |
| 50 | 280 | output[i] = std::min(output[i], row[i]); | |
| 51 | } | ||
| 52 | } | ||
| 53 | |||
| 54 | return true; | ||
| 55 | } | ||
| 56 | |||
| 57 | 64 | bool ChyokotovMinValByColumnsSEQ::PostProcessingImpl() { | |
| 58 | 64 | return true; | |
| 59 | } | ||
| 60 | |||
| 61 | } // namespace chyokotov_min_val_by_columns | ||
| 62 |