/
| 120 | |
| 121 | /*********************************************************/ |
| 122 | int solve_elevatr(int *B, int Max, int N) |
| 123 | { int B2[100000], k, best, res; |
| 124 | |
| 125 | best = -1; |
| 126 | /* Do it once with an initial positive direction: */ |
| 127 | memcpy(B2, B, N*sizeof(int)); |
| 128 | res = complete_seq(B2, Max, N, 1); |
| 129 | if (res >= 0) { |
| 130 | if ((best == -1) || (res < best)) |
| 131 | best = res; |
| 132 | } |
| 133 | |
| 134 | /* Repeat with an initial negative direction: */ |
| 135 | memcpy(B2, B, N*sizeof(int)); |
| 136 | res = complete_seq(B2, Max, N, -1); |
| 137 | if (res >= 0) { |
| 138 | if ((best == -1) || (res < best)) |
| 139 | best = res; |
| 140 | } |
| 141 | return best; |
| 142 | } |
| 143 | |
| 144 | /********************************************************/ |
| 145 | int elevatr() |
no test coverage detected