codeforces-scrape

Codeforces scraped problems and editorials
git clone git://git.laack.co/codeforces-scrape.git
Log | Files | Refs | README

683B.md (1379B)


      1 Source: https://codeforces.com/problemset/problem/683/B
      2 
      3 B. The Teacher of Physical Education
      4 
      5 time limit per test
      6 
      7 1 second
      8 
      9 memory limit per test
     10 
     11 256 megabytes
     12 
     13 input
     14 
     15 standard input
     16 
     17 output
     18 
     19 standard output
     20 
     21 *n* pupils came to Physical Education lesson. We know the name and the height of each pupil.
     22 
     23 Your task is to help the teacher of Physical Education to line up all pupils in non-decreasing order of their heights.
     24 
     25 Input
     26 
     27 The first line contains the positive integer *n* (1 ≤ *n* ≤ 5000) — the number of pupils.
     28 
     29 The next *n* lines contain the pupils' description. In the *i*-th line there is pupil's name *name**i* (a non-empty string which consists of uppercase and lowercase Latin letters, the length does not exceed five) and pupil's height *x**i* (130 ≤ *x**i* ≤ 215). Some pupils can have the same name. Uppercase and lowercase letters of the alphabet should be considered different.
     30 
     31 Output
     32 
     33 Print *n* lines — pupils' names in the non-decreasing order of their heights. Each line must contain exactly one name.
     34 
     35 If there are several answers, print any of them. Uppercase and lowercase letters of the alphabet should be considered different.
     36 
     37 Examples
     38 
     39 Input
     40 
     41 ```
     42 4  
     43 Ivan 150  
     44 Igor 215  
     45 Dasha 158  
     46 Katya 150
     47 ```
     48 
     49 Output
     50 
     51 ```
     52 Ivan  
     53 Katya  
     54 Dasha  
     55 Igor
     56 ```
     57 
     58 Input
     59 
     60 ```
     61 2  
     62 SASHA 180  
     63 SASHA 170
     64 ```
     65 
     66 Output
     67 
     68 ```
     69 SASHA  
     70 SASHA
     71 ```