There are N hills labeled from 0 to N-1 and N+1 villages labeled from 0 to N. The i th village is situated between the (i-1) th and the (i) th hill, except the 0th village which is situated just before the 0th hill and the (N+1) th village which is situated just after the Nth hill. Each hill has 2 peaks.
8 9
10
Each pair (ij) of villages has a distinct
messenger who travels from village i to village j and back. Given the height of all the hills, you need to find out the number of messengers, for each of whom the maximum height among the first peak and minimum height among the second peak of the mountains that they'll cross would be equal.
Answers
Answer:
Banjjok gateun sori haji ma
Nae banjjok ije nae geoya
Nappeun yeonirago haji ma
Nappeun geon neoui geunyeoya
XOXO
There are N hills labeled from 0 to N-1 and N+1 villages labeled from 0 to N. The i th village is situated between the (i-1) th and the (i) th hill, except the 0th village which is situated just before the 0th hill and the (N+1) th village which is situated just after the Nth hill. Each hill has 2 peaks.
8 9
10
Each pair (ij) of villages has a distinct
messenger who travels from village i to village j and back. Given the height of all the hills, you need to find out the number of messengers, for each of whom the maximum height among the first peak and minimum height among the second peak of the mountains that they'll cross would be equal.