Given a list of N (1 <= N <= 50000) integers. You are required to compute the number of pairs of indexes whose values are the same, and also the maximum distance between two indexes with equal values. N will be given in the first line of the input. N lines follow, each one with one integer from the list. If no identical pairs are found, print NA, otherwise print a single line with two integers, the number of identical pairs, and the maximum distance between indexes with equal values.
Case 1:
For the input provided as follows:
5
1
3
1
6
3
Output of the program will be:
2 3
Case 2:
For the input provided as follows:
6
1
2
3
4
5
6
Output of the program will be:
NA
Case 1:
For the input provided as follows:
5
1
3
1
6
3
Output of the program will be:
2 3
Case 2:
For the input provided as follows:
6
1
2
3
4
5
6
Output of the program will be:
NA






0 comments:
Đăng nhận xét