CodeForces 441A Valera and Antique Items
2016-01-05 20:15
1131 查看
A. Valera and Antique Items
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output
Description
Valera is a collector. Once he wanted to expand his collection with exactly one antique item.
Valera knows n sellers of antiques, thei-th of them auctionedki items. Currently the auction price
of thej-th object of thei-th seller issij. Valera gets on well with each of then
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 then sellers he can make a deal with.
Input
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 ki(1 ≤ ki ≤ 50) the number of items of thei-th
seller. Then go ki space-separated integerssi1, si2, ..., siki(104 ≤ sij ≤ 106)
— the current prices of the items of the i-th seller.
Output
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 integersq1, q2, ..., qp(1 ≤ qi ≤ n)
— the numbers of the sellers with who Valera can make a deal. Print the numbers of the sellersin the increasing order.
Sample Input
Input
Output
Input
Output
Hint
In the first sample Valera can bargain with each of the sellers. He can outbid the following items: a40000 item from the first seller, a20000 item from the second seller, and a10000
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.
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output
Description
Valera is a collector. Once he wanted to expand his collection with exactly one antique item.
Valera knows n sellers of antiques, thei-th of them auctionedki items. Currently the auction price
of thej-th object of thei-th seller issij. Valera gets on well with each of then
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 then sellers he can make a deal with.
Input
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 ki(1 ≤ ki ≤ 50) the number of items of thei-th
seller. Then go ki space-separated integerssi1, si2, ..., siki(104 ≤ sij ≤ 106)
— the current prices of the items of the i-th seller.
Output
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 integersq1, q2, ..., qp(1 ≤ qi ≤ n)
— the numbers of the sellers with who Valera can make a deal. Print the numbers of the sellersin the increasing order.
Sample Input
Input
3 50000 1 40000 2 20000 60000 3 10000 70000 190000
Output
3 1 2 3
Input
3 50000 1 50000 3 100000 120000 110000 3 120000 110000 120000
Output
0
Hint
In the first sample Valera can bargain with each of the sellers. He can outbid the following items: a40000 item from the first seller, a20000 item from the second seller, and a10000
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.
#include<iostream> #include<algorithm> using namespace std; int main(){ int n,v,p,i,price,num[60],flag,x; while(cin>>n>>v){ x=flag=0; for(i=1;i<=n;i++){ cin>>p; while(p--){ cin>>price; if(v>price){ flag=1; } } if(flag){ num[x]=i; x++; flag=0; } } cout<<x<<endl; for(i=0;i<x;i++){ if(i==x-1){ cout<<num[i]<<endl; } else{ cout<<num[i]<<" "; } } } return 0; }
相关文章推荐
- IOS模态视图 (UI页面切换)
- easyui combobox级联(转载)
- iOS开发学习之UI篇3、UILabel
- leetcode第一刷_Unique Paths
- 优化UITableViewCell高度计算的那些事 附源码
- (转载)iOS UILabel自定义行间距时获取高度
- IOS(UI)_UIButton(按钮)和UIImageView(图片按钮)
- iOS开发学习之UI篇 1、UIView
- IOS(UI)_UILabel(标签)
- UE 无法初始化FTP组件
- 有value时,li元素序列号就是value值,没有value,则会递增
- 关于百度 UEditor的使用
- Android can only be built by versions 3.81 and 3.82
- Arduino 中断和定时器
- lintcode :implement queue by two stacks 用栈实现队列
- UIAlertController
- UIView设置指定的border
- 给UIView 的子类们 UIButton UILbel等 。。。。加一个虚线圆角的border
- wifi模块ESP8266_AT arduino 库文件部分方法解析及优化
- iOS中xcode的调试技巧(打印UI层次、po)