Definite and Perpendicular
All submissions for this problem are available.
Long time back in the city of Wasseypur a party was being organized by Ramadhir Singh. The two prodigies of Wasseypur Definite and Perpendicular decide to have some fun at the party. They tell N guests present at the party to choose a lucky number of their choice. The guests are assigned unique numbers starting from 0 in increasing order. No more than two guests will have same lucky number. The guests didn’t knew that this lucky number would soon turn unlucky for them. Definite and Perpendicular then calculate the minimum distance between the numbers. Minimum distance is defined as the absolute difference between two numbers. The two guests whose lucky numbers would constitute the minimum distance would be selected to pay the bill for the whole party. But Definite and Perpendicular are facing problems in calculating the minimum distance. You have to help them in solving this problem to find out which two guests would pay the bill for the party. If you are able to help Definite and Perpendicular they will praise you, else be content with the fact “Tumse na ho payega :P”
- The first line of the input contains an integer T denoting the number of test cases. The description of T test cases follows.
- The total number of guests present in the party denoted by N
- An array of lucky numbers of size N, where each element of the array is space separated and represent the lucky number of the guest whose index start from 0.
For each test case, output the following.
- Minimum distance
- The next line should contain space separated unique number assigned to guests who would be paying the bill. These unique numbers should be in increasing order.
Should contain all the constraints on the input data that you may have. Format it like:
- 1 ≤ T ≤ 100
- 2 ≤ N ≤ 10^7
Input: 1 5 2 10 5 3 8 Output: 1 0 3
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.5, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, SCM chicken, CLOJ, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.