A9519 | Valera and Antique Items
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
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.
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.
输入格式
The first line contains two space-separated integers $n,v$ $(1<=n<=50; 10^{4}<=v<=10^{6})$ — 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_{i1},s_{i2},...,s_{iki}$ $(10^{4}<=s_{ij}<=10^{6})$ — the current prices of the items of the $i$ -th seller.
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_{i1},s_{i2},...,s_{iki}$ $(10^{4}<=s_{ij}<=10^{6})$ — the current prices of the items of the $i$ -th seller.
输出格式
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.
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.
输入输出样例
输入 #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.
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.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted