CF441A.Valera and Antique Items

入门

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Valera is a collector. Once he wanted to expand his collection with exactly one antique item.

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.

Unfortunately, Valera has only v units of money. Help him to determine which of the n sellers he can make a deal with.

瓦列拉是一位收藏家。他希望恰好用一件古董来扩充自己的收藏。

瓦列拉认识 nn 位古董卖家,其中第 ii 位卖家正在拍卖 kik_i 件物品。目前,第 ii 位卖家所售的第 jj 件物品的拍卖价格为 sijs_{ij}。瓦列拉与这 nn 位卖家关系都很好。他完全确信:只要他对某件物品的出价高于其当前拍卖价格(即向卖家支付严格大于该物品当前拍卖价格的金额),该物品的卖家便会立即与他签订合同。

不幸的是,瓦列拉仅有 vv 单位的资金。请帮助他判断:他能与这 nn 位卖家中的哪些人达成交易?

输入格式

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.

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.

第一行包含两个以空格分隔的整数 nn 和 vv(1≤n≤501 \leq n \leq 50;104≤v≤10610^4 \leq v \leq 10^6)—— 分别表示卖家数量以及瓦莱拉所拥有的钱数(单位)。

接下来是 nn 行。第 ii 行首先包含一个整数 kik_i(1≤ki≤501 \leq k_i \leq 50),表示第 ii 个卖家的商品数量;随后是 kik_i 个以空格分隔的整数 si1, si2, …, sikis_{i1},\,s_{i2},\,\dots,\,s_{ik_i}(104≤sij≤10610^4 \leq s_{ij} \leq 10^6)—— 表示第 ii 个卖家所售商品的当前价格。

输出格式

In the first line, print integer p — the number of sellers with who Valera can make a deal.

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.

第一行输出整数 pp —— Valera 能够与之达成交易的卖家数量。

第二行输出 pp 个以空格分隔的整数 q1, q2, …, qpq_1,\ q_2,\ \dots,\ q_p(其中 1≤qi≤n1 \le q_i \le n)—— 表示 Valera 能够与之达成交易的卖家编号。请按递增顺序输出这些卖家编号。

输入输出样例

  • 输入#1

    3 50000
    1 40000
    2 20000 60000
    3 10000 70000 190000

    输出#1

    3
    1 2 3
  • 输入#2

    3 50000
    1 50000
    3 100000 120000 110000
    3 120000 110000 120000

    输出#2

    0

说明/提示

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.

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.

在第一个样例中,瓦莱拉可以与每位卖家讨价还价。他能够成功出价竞得以下商品:第一位卖家的 40000 元商品、第二位卖家的 20000 元商品,以及第三位卖家的 10000 元商品。

在第二个样例中,瓦莱拉无法与任何一位卖家达成交易,因为拍卖中所有商品的价格对他而言都过高。

输入解题思路,AI测评打分。不知道怎么写?

首页