| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "kiselev_i_max_value_in_strings/seq/include/ops_seq.hpp" | ||
| 2 | |||
| 3 | #include <algorithm> | ||
| 4 | #include <cstddef> | ||
| 5 | #include <limits> | ||
| 6 | #include <utility> | ||
| 7 | #include <vector> | ||
| 8 | |||
| 9 | #include "kiselev_i_max_value_in_strings/common/include/common.hpp" | ||
| 10 | |||
| 11 | namespace kiselev_i_max_value_in_strings { | ||
| 12 | |||
| 13 |
1/2✓ Branch 1 taken 128 times.
✗ Branch 2 not taken.
|
128 | KiselevITestTaskSEQ::KiselevITestTaskSEQ(const InType &in) { |
| 14 | SetTypeOfTask(GetStaticTypeOfTask()); | ||
| 15 |
1/2✓ Branch 1 taken 128 times.
✗ Branch 2 not taken.
|
128 | auto in_copy = in; |
| 16 | 128 | GetInput() = std::move(in_copy); | |
| 17 | GetOutput().clear(); | ||
| 18 | 128 | } | |
| 19 | |||
| 20 | 128 | bool KiselevITestTaskSEQ::ValidationImpl() { | |
| 21 | const auto &matrix = GetInput(); | ||
| 22 | if (matrix.empty()) { | ||
| 23 | return true; | ||
| 24 | } | ||
| 25 | return true; | ||
| 26 | } | ||
| 27 | |||
| 28 | 128 | bool KiselevITestTaskSEQ::PreProcessingImpl() { | |
| 29 | const auto &matrix = GetInput(); | ||
| 30 | 128 | GetOutput().resize(matrix.size()); | |
| 31 | 128 | return true; | |
| 32 | } | ||
| 33 | |||
| 34 | 128 | bool KiselevITestTaskSEQ::RunImpl() { | |
| 35 | const auto &matrix = GetInput(); | ||
| 36 | auto &out_vector = GetOutput(); | ||
| 37 | |||
| 38 | std::size_t row_idx = 0; | ||
| 39 |
2/2✓ Branch 0 taken 352 times.
✓ Branch 1 taken 128 times.
|
480 | for (const auto &row : matrix) { |
| 40 |
2/2✓ Branch 0 taken 32 times.
✓ Branch 1 taken 320 times.
|
352 | if (row.empty()) { |
| 41 | // пустая строка → минимальное значение int | ||
| 42 | 32 | out_vector[row_idx++] = std::numeric_limits<int>::min(); | |
| 43 | } else { | ||
| 44 | 320 | int tmp_max = row[0]; | |
| 45 |
2/2✓ Branch 0 taken 1512 times.
✓ Branch 1 taken 320 times.
|
1832 | for (int val : row) { |
| 46 | 1512 | tmp_max = std::max(val, tmp_max); | |
| 47 | } | ||
| 48 | 320 | out_vector[row_idx++] = tmp_max; | |
| 49 | } | ||
| 50 | } | ||
| 51 | 128 | return true; | |
| 52 | } | ||
| 53 | |||
| 54 | 128 | bool KiselevITestTaskSEQ::PostProcessingImpl() { | |
| 55 | 128 | return true; | |
| 56 | } | ||
| 57 | |||
| 58 | } // namespace kiselev_i_max_value_in_strings | ||
| 59 |