CodeForces 441 A. Valera and Antique Items

CodeForces 441 A. Valera and Antique Items

大家好,又见面了,我是全栈君,今天给大家准备了Idea注册码。

纯粹练JAVA….

A. Valera and Antique Items
time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

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 ki items. Currently the auction price of the j-th object of the i-th seller issij. 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.

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 the i-th seller. Then go ki space-separated integers si1, 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 integers q1, q2, …, qp (1 ≤ qi ≤ n) — the numbers of the sellers with who Valera can make a deal. Print the numbers of the sellers in the increasing order.

Sample test(s)
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

Note

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, a20000 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.


import java.util.*;

public class Main
{
	public static void main(String[] args)
	{
		Scanner cin=new Scanner(System.in);
		int n=cin.nextInt(),v=cin.nextInt();
		int count=0; 
		StringBuilder ans= new StringBuilder();
		for(int lll=0;lll<n;lll++)
		{
			int k=cin.nextInt();
			boolean flag=false;
			for(int i=0;i<k;i++)
			{
				int temp=cin.nextInt();
				if(temp<v)
				{
					flag=true;
				}
			}
			if(flag)
			{
				count++;
				ans.append((lll+1)+" ");
			}
		}
		System.out.println(count);
		System.out.println(ans.toString().trim());
	}
}

版权声明:来自: 代码代码猿猿AC路 http://blog.csdn.net/ck_boss

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/117206.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • Nginx_handler模块发开(hello模块结构解析)「建议收藏」

    Nginx_handler模块发开(hello模块结构解析)

    2022年2月5日
    48
  • 解决MyQL数据库中1045错误的方法——Windows系统

    解决MyQL数据库中1045错误的方法——Windows系统在各种各样的适用场所,MySQL会出现各种各样的问题,经过足足半年的长跑,我的数据库终于修复了Bug,可以重新使用了。数据库出问题,那可能是家常便饭了。经过这足足半年的煎熬,我决定在以后的日子里,记录下我在使用数据库时遇到的色彩缤纷的问题,以及这些问题的解决方法。由此,今天写了这篇博客。首先,给大家看看,这个问题是什么样子的。我在这里用到的MySQL可视化工具为Navicat。这个错误…

    2022年6月13日
    27
  • ip route add添加路由_怎么设置route add

    ip route add添加路由_怎么设置route add       

    2022年8月12日
    6
  • [算法系列之十二]字符串匹配之蛮力匹配

    [算法系列之十二]字符串匹配之蛮力匹配引言字符串匹配是数据库开发和文字处理软件的关键。幸运的是所有现代编程语言和字符串库函数,帮助我们的日常工作。不过理解他们的原理还是比较重要的。字符串算法主要可以分为几类。字符串匹配就是其中之一。当我们提到字符串匹配算法,最基本的方法就是所谓的蛮力解法,这意味着我们需要检查每一个文本串中的字符是否和匹配串相匹配。一般来说我们有文本串和一个匹配串(通常匹配串短于文本串)。我们需要做的就是回答这个匹配串是

    2022年8月21日
    4
  • 用Java代码实现学生管理系统[通俗易懂]

    用Java代码实现学生管理系统[通俗易懂]学生管理系统1.1项目演示1.2学生管理系统实现思路定义学生类主界面的代码编写添加学生的代码编写查看学生的代码编写删除学生的的代码编写修改学生的代码编写1.3定义学生类学生类:Student成员变量:学号:sid姓名:name年龄:age居住地:address构造方法:无参构造带四个参数的构造成员方法:每个成员变量对应给出get/set方法1.4主界面的代码编写思路用输出语句完成主界面的编写用Scanner实现键盘录

    2022年9月20日
    0
  • Tensorflow2.0使用Resnet18进行数据训练[通俗易懂]

    Tensorflow2.0使用Resnet18进行数据训练[通俗易懂]在今年的3月7号,谷歌在TensorflowDeveloperSummit2019大会上发布TensorFlow2.0Alpha版,随后又发布的了Beta版本。Resnet18结构Tensorflow搭建Resnet18导入第三方库importtensorflowastffromtensorflowimportkerasfromtensorflo…

    2022年5月9日
    155

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号