Triple Peaks
면접 대비시간 제한2초메모리 제한2048 MB
세 봉우리의 높이 세 개가 세 쌍 사이의 거리와 순서를 무시하고 일치하는 삼중항의 개수를 센다.
문제
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.
예제
이 문제는 공개된 예제가 없습니다.