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)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • 网站背景音乐HTML代码_ppt播放背景音乐

    网站背景音乐HTML代码_ppt播放背景音乐这篇文章主要为大家详细介绍了HTML5页面背景音乐代码网页背景音乐通用代码,具有一定的参考价值,感兴趣的小伙伴们可以参考一下,有需要的朋友可以收藏方便以后借鉴。网页背景音乐是个比较老旧的问题和技术了,上世纪90年代就是十分流行的了,给自己的网页加上一段背景音乐轻快而且于感染力,随着网页技术的发展,除了少部分音乐站点、个人博客、游戏站点外几乎很少有使用到网页背景音乐的地方,当然了这也是织梦361小…

    2022年9月24日
    3
  • unboundlocalerror python_Python问题:UnboundLocalError: local variable ‘xxx’ referenced before assignme…[通俗易懂]

    unboundlocalerror python_Python问题:UnboundLocalError: local variable ‘xxx’ referenced before assignme…[通俗易懂]参考链接:【解析】UnboundLocalError:localvariable’xxx’referencedbeforeassignment在函数外部已经定义了变量n,在函数内部对该变量进行运算,运行时会遇到了这样的错误:主要是因为没有让解释器清楚变量是全局变量还是局部变量。【案例】如下代码片所示:deftest():ifvalue==1:a+=1returnavalue=…

    2022年6月24日
    28
  • PID算法详解[通俗易懂]

    PID算法详解[通俗易懂]PID算法是一种具有预见性的控制算法,其核心思想是:1>.PID算法不但考虑控制对象的当前状态值(现在状态),而且还考虑控制对象过去一段时间的状态值(历史状态)和最近一段时间的状态值变化(预期),由这3方面共同决定当前的输出控制信号;2>.PID控制算法的运算结果是一个数,利用这个数来控制被控对象在多种工作状态(比如加热器的多种功率,阀门的多种开度等)工作,一般输出形式为PWM,基本上满足了按需输出控制信号,根据情况随时改变输出的目的。比例控制是一种最简单的控制方式。其控制器的输出与输入误差信号成比例

    2022年9月26日
    0
  • PyCharm 汉化

    PyCharm 汉化汉化汉化资源地址:链接:https://pan.baidu.com/s/1htwrK5e密码:1c4d将汉化包”resources_cn.jar”放置到lib下,删除”resources_en.jar”,重启PyCharm步骤如下:…

    2022年5月26日
    48
  • PrCharm激活码【在线破解激活】[通俗易懂]

    PrCharm激活码【在线破解激活】,https://javaforall.net/100143.html。详细ieda激活码不妨到全栈程序员必看教程网一起来了解一下吧!

    2022年3月16日
    77
  • 在Spring Boot中使用Spring-data-Jpa,findOne()方法无效

    在学习SpringBoot过程中,发现在使用Jpa进行数据库操作的时候,Jpa的findOne()根据主键查数据方法无效了,让我很纳闷,之后查了一下百度,发现是SpringBoot版本问题 使用的版本是SpringBoot 2.0.4既然找不到findOne()方法,可以找一下别的嘛,然后发现里面有个叫findById()的方法,有点像了。。。。 但是神奇的发现,他的返回类型是…

    2021年11月30日
    78

发表回复

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

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