Triple Peaks
문제
The Cordillera Oriental is a mountain range in the Andes that stretches across Bolivia. It consists of a sequence of mountain peaks, numbered from to . The height of peak () is , which is an integer between and , inclusive.
For any two peaks and where , the distance between them is defined as .
According to ancient Inca legends, a triple of peaks is mythical if it has the following special property: the heights of the three peaks match their pairwise distances ignoring the order.
Formally, a triple of indices is mythical if
- , and
- the heights match the pairwise distances ignoring the order. For example, for indices the pairwise distances are , so the heights , , and all match them, but the heights do not match them.
This problem consists of two parts, with each subtask associated with either Part I or Part II. You may solve the subtasks in any order. In particular, you are not required to complete all of Part I before attempting Part II.