| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "kulik_a_the_most_different_adjacent/seq/include/ops_seq.hpp" | ||
| 2 | |||
| 3 | #include <cmath> | ||
| 4 | #include <cstddef> | ||
| 5 | #include <cstdint> | ||
| 6 | #include <vector> | ||
| 7 | |||
| 8 | #include "kulik_a_the_most_different_adjacent/common/include/common.hpp" | ||
| 9 | |||
| 10 | namespace kulik_a_the_most_different_adjacent { | ||
| 11 | |||
| 12 |
1/2✓ Branch 1 taken 24 times.
✗ Branch 2 not taken.
|
24 | KulikATheMostDifferentAdjacentSEQ::KulikATheMostDifferentAdjacentSEQ(const InType &in) { |
| 13 | SetTypeOfTask(GetStaticTypeOfTask()); | ||
| 14 |
1/2✓ Branch 1 taken 24 times.
✗ Branch 2 not taken.
|
24 | GetInput() = in; |
| 15 | 24 | } | |
| 16 | |||
| 17 | 24 | bool KulikATheMostDifferentAdjacentSEQ::ValidationImpl() { | |
| 18 | 24 | return (GetInput().size() >= 2); | |
| 19 | } | ||
| 20 | |||
| 21 | 24 | bool KulikATheMostDifferentAdjacentSEQ::PreProcessingImpl() { | |
| 22 | 24 | return true; | |
| 23 | } | ||
| 24 | |||
| 25 | 24 | bool KulikATheMostDifferentAdjacentSEQ::RunImpl() { | |
| 26 | const auto &input = GetInput(); | ||
| 27 | const auto n = input.size(); | ||
| 28 | OutType &ans = GetOutput(); | ||
| 29 | double mx = 0.; | ||
| 30 | uint64_t ind = 0; | ||
| 31 |
2/2✓ Branch 0 taken 72800040 times.
✓ Branch 1 taken 24 times.
|
72800064 | for (size_t i = 1; i < n; ++i) { |
| 32 |
2/2✓ Branch 0 taken 296 times.
✓ Branch 1 taken 72799744 times.
|
72800040 | if (std::abs(input[i - 1] - input[i]) > mx) { |
| 33 | mx = std::abs(input[i - 1] - input[i]); | ||
| 34 | ind = i - 1; | ||
| 35 | } | ||
| 36 | } | ||
| 37 | 24 | ans.first = ind; | |
| 38 | 24 | ans.second = ind + 1; | |
| 39 | 24 | return true; | |
| 40 | } | ||
| 41 | |||
| 42 | 24 | bool KulikATheMostDifferentAdjacentSEQ::PostProcessingImpl() { | |
| 43 | 24 | return (GetOutput().second == (GetOutput().first + 1)); | |
| 44 | } | ||
| 45 | |||
| 46 | } // namespace kulik_a_the_most_different_adjacent | ||
| 47 |