codeforces-scrape

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

441A.md (2317B)


      1 Source: https://codeforces.com/problemset/problem/441/A
      2 
      3 A. Valera and Antique Items
      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 stdin
     16 
     17 output
     18 
     19 stdout
     20 
     21 Valera is a collector. Once he wanted to expand his collection with exactly one antique item.
     22 
     23 Valera knows *n* sellers of antiques, the *i*-th of them auctioned *k**i* items. Currently the auction price of the *j*-th object of the *i*-th seller is *s**ij*. Valera gets on well with each of the *n* sellers. He is perfectly sure that if he outbids the current price of one of the items in the auction (in other words, offers the seller the money that is strictly greater than the current price of the item at the auction), the seller of the object will immediately sign a contract with him.
     24 
     25 Unfortunately, Valera has only *v* units of money. Help him to determine which of the *n* sellers he can make a deal with.
     26 
     27 Input
     28 
     29 The first line contains two space-separated integers *n*, *v* (1 ≤ *n* ≤ 50; 104 ≤ *v* ≤ 106) — the number of sellers and the units of money the Valera has.
     30 
     31 Then *n* lines follow. The *i*-th line first contains integer *k**i* (1 ≤ *k**i* ≤ 50) the number of items of the *i*-th seller. Then go *k**i* space-separated integers *s**i*1, *s**i*2, ..., *s**ik**i* (104 ≤ *s**ij* ≤ 106) — the current prices of the items of the *i*-th seller.
     32 
     33 Output
     34 
     35 In the first line, print integer *p* — the number of sellers with who Valera can make a deal.
     36 
     37 In the second line print *p* space-separated integers *q*1, *q*2, ..., *q**p* (1 ≤ *q**i* ≤ *n*) — the numbers of the sellers with who Valera can make a deal. Print the numbers of the sellers in the increasing order.
     38 
     39 Examples
     40 
     41 Input
     42 
     43 ```
     44 3 50000  
     45 1 40000  
     46 2 20000 60000  
     47 3 10000 70000 190000
     48 ```
     49 
     50 Output
     51 
     52 ```
     53 3  
     54 1 2 3
     55 ```
     56 
     57 Input
     58 
     59 ```
     60 3 50000  
     61 1 50000  
     62 3 100000 120000 110000  
     63 3 120000 110000 120000
     64 ```
     65 
     66 Output
     67 
     68 ```
     69 0
     70 ```
     71 
     72 Note
     73 
     74 In the first sample Valera can bargain with each of the sellers. He can outbid the following items: a 40000 item from the first seller, a 20000 item from the second seller, and a 10000 item from the third seller.
     75 
     76 In the second sample Valera can not make a deal with any of the sellers, as the prices of all items in the auction too big for him.