## Welcome To SDIBT ACM-ICPC Online Judge

Problem 1042. -- Shoemaker's Problem ## Shoemaker's Problem

Time Limit: 1 Sec Memory Limit: 64 MB

Submit: 8 Solved: 6

[Submit][Status][Discuss]## Description

Shoemaker has N jobs (orders from customers) which he must make. Shoemaker can
work on only one job in each day. For each i_{th} job, it is known the integer T_{i} (1<=T_{i}<=1000), the time in days it takes the shoemaker to finish the job.
For each day of delay before starting to work for the i_{th} job, shoemaker must pay a fine of
S_{i} (1<=S_{i}<=10000) cents. Your task is to help the shoemaker, writing a programm to find the sequence of jobs with minimal total fine.

## Input

The input begins with a single positive integer on a line by itself indicating the number of the cases following, each of them as described below. This line is followed by a blank line, and there is also a blank line between two consecutive inputs.

First line of input contains an integer N (1<=N<=1000). The next N lines each contain two numbers: the time and fine of each
task in order.

## Output

For each test case, your program should print the sequence of jobs with minimal fine. Each job should be represented by its position in the input. All integers should be placed on only one output line and each pair separated by one space. If multiple solutions are possible, print the first one in lexicographic order.
The output of two consecutive cases must be separated by a blank line.

## Sample Input

1
4
3 4
1 1000
2 2
5 5

## Sample Output

2 1 3 4

## HINT

## Source

[Submit][Status][Discuss]

HOME
Back

한국어 中文 English

All Copyright Reserved 2008-2010 SDIBT TEAM

GPL2.0 2003-2010 HUSTOJ Project TEAM

Anything about the Problems, Please Contact Admin:admin