Party Medley
면접 대비시간 제한1초메모리 제한2048 MB
최대 평가와 최소 평가의 차이가 M 이하인 세 학생 조합의 개수를 세고, 그중 평가 합이 가장 큰 값을 구한다. N은 200 이하다.
문제
ICPC University has students, numbered from to , in its Competitive Programming club. Student has a rating of representing their estimated skill in competitive problem-solving.
Contest season is coming and Morgan, the coach of the Competitive Programming club, would like to send at most one good team to a particular contest due to their limited budget. A team consists of exactly different students. Suppose that a team consists of student , , and . Their team rating is , and their rating difference is .
Morgan believes that a team is balanced if their rating difference is no more than a threshold of . Additionally, he also would like the team rating to be as large as possible while being a balanced team as well.
Morgan asks you to compute two values. The first value is the number of different balanced team configurations that can be made. The second value is the largest team rating of a balanced team that can be made.
Two team configurations are different if and only if there is at least one different student between those team configurations.
입력
Input begins with two integers (; ) representing the number of students and the threshold for rating difference, respectively. The next line contains integers () representing the rating of student .
출력
If there is at least one balanced team configuration, then output two space-separated integers in a single line representing the number of different balanced team configurations and the largest team rating of any balanced team, respectively.
If there is no balanced team configuration, then output -1 in a single line.