Programming contests

ECN programozó csapatverseny, 2017. május 13.

May 13, 2017 10:10 AM – May 13, 2017 3:10 PM

Pyramid

The key parameters of the “gradual square pyramid” from the figures are stair depth (x) and stair height (y). Given the (x1,y1), (x2,y2), …, (xn,yn) pair sequence (n ≤ 20; xi < 100, yi < 10, i=1, …,n), find out the optimal succession that minimize the volume of the pyramid.

Input Specification

The first line of the input contains the number of the given test cases, after which each line contains a test case: the value of n, followed by pairs of integers representing the stair height and depth, separated by white characters: n y1 x1 y2 x2yn xn.

Output Specification

A line for each test case written to the standard output: the indexes of the height-depth pairs in the correct order, separated by spaces.

Sample Input

  1. 1
  2. 6 3 10 2 11 1 5 3 11 2 5 1 10
download as text file

Output for Sample Input

  1. 5 1 4 3 2 6
download as text file
University of Debrecen; Faculty of Informatics; v. 03/01/2019