CodeForces 441A Valera and Antique Items
来源:互联网 发布:软件开发项目成果 编辑:程序博客网 时间:2024/06/05 23:54
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
3 500001 400002 20000 600003 10000 70000 190000
31 2 3
3 500001 500003 100000 120000 1100003 120000 110000 120000
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;}
- CodeForces 441 A. Valera and Antique Items
- CodeForces 441A Valera and Antique Items
- CodeForces 441A Valera and Antique Items
- codeforces 441A Valera and Antique Items
- CodeForces 252A-Valera and Antique Items
- A. Valera and Antique Items
- Codeforces Round #252 (Div. 2)A. Valera and Antique Items
- Codeforces Round #252 (Div. 2) A. Valera and Antique Items
- Codeforces Round #252 (Div. 2) 441A Valera and Antique Items
- Codeforces Round #252(Div. 2) 441A. Valera and Antique Items 水题
- Codeforces441A_Valera and Antique Items(水题)
- codeforces 404A - Valera and X
- codeforces A. Valera and Plates 题解
- Codeforces A. Valera and X 题解
- CodeForces 379A Valera and Plates
- CodeForces - 404A: Valera and X
- CodeForces 404A Valera and X【水题】
- Codeforces 441C Valera and Tubes
- java代理机制
- Linux内核构建系统之一
- 面向对象的设计模式(十一),装饰模式
- 查询表结构
- Python,Jupyter Notebook,IPython快速安装教程
- CodeForces 441A Valera and Antique Items
- 一个字符串排序的程序
- 《HeadFirst JavaScript》学习笔记
- Linux内核构建系统之二
- Activity后台运行一段时间回来crash问题的分析与解决
- C++ 输入输出流和文件流 (2010-01-17 13:34:03)http://blog.sina.com.cn/s/blog_700a65cc0100mi5o.html
- 数据结构与算法——给定整数A1,A2,....An,....(可能有负数),求该数据序列的最大子序列的和
- Unity不规则碰撞
- 插件升级“无法定位 WordPress 内容目录”