106B.md (1920B)
1 Source: https://codeforces.com/problemset/problem/106/B 2 3 B. Choosing Laptop 4 5 time limit per test 6 7 2 seconds 8 9 memory limit per test 10 11 256 megabytes 12 13 input 14 15 stdin 16 17 output 18 19 stdout 20 21 Vasya is choosing a laptop. The shop has *n* laptops to all tastes. 22 23 Vasya is interested in the following properties: processor speed, ram and hdd. Vasya is a programmer and not a gamer which is why he is not interested in all other properties. 24 25 If all three properties of a laptop are strictly less than those properties of some other laptop, then the first laptop is considered outdated by Vasya. Among all laptops Vasya does not consider outdated, he chooses the cheapest one. 26 27 There are very many laptops, which is why Vasya decided to write a program that chooses the suitable laptop. However, Vasya doesn't have his own laptop yet and he asks you to help him. 28 29 Input 30 31 The first line contains number *n* (1 ≤ *n* ≤ 100). 32 33 Then follow *n* lines. Each describes a laptop as *speed* *ram* *hdd* *cost*. Besides, 34 35 * *speed*, *ram*, *hdd* and *cost* are integers 36 * 1000 ≤ *speed* ≤ 4200 is the processor's speed in megahertz 37 * 256 ≤ *ram* ≤ 4096 the RAM volume in megabytes 38 * 1 ≤ *hdd* ≤ 500 is the HDD in gigabytes 39 * 100 ≤ *cost* ≤ 1000 is price in tugriks 40 41 All laptops have different prices. 42 43 Output 44 45 Print a single number — the number of a laptop Vasya will choose. The laptops are numbered with positive integers from 1 to *n* in the order in which they are given in the input data. 46 47 Examples 48 49 Input 50 51 ``` 52 5 53 2100 512 150 200 54 2000 2048 240 350 55 2300 1024 200 320 56 2500 2048 80 300 57 2000 512 180 150 58 ``` 59 60 Output 61 62 ``` 63 4 64 ``` 65 66 Note 67 68 In the third sample Vasya considers the first and fifth laptops outdated as all of their properties cannot match those of the third laptop. The fourth one is the cheapest among the laptops that are left. Thus, Vasya chooses the fourth laptop.