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

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

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

【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛

【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...

(0)


相关推荐

  • 简单VBS教程「建议收藏」

    简单VBS教程「建议收藏」讲一下VBScript。主要面向菜鸟,懂得编程的朋友就不要浪费时间了,如果你想接触以下VBScript也可以。但既然有编程基础推荐直接去找一些参考书来读。会比较快。    什么是VBScript呢?VBScript的全称是:MicrosoftVisualBasicScriptEditon.(微软公司可视化BASIC脚本版)。正如其字面所透露的信息,VBS(VBScript的进一步简写)是基…

  • qmake实用变量[通俗易懂]

    qmake实用变量[通俗易懂]一些项目开发中用到的qmake实用变量。

  • Html5_禁止Html5在手机上屏幕页面缩放

    Html5_禁止Html5在手机上屏幕页面缩放

  • SpringBoot2.0 Actuator 监控参数说明

    SpringBoot2.0 Actuator 监控参数说明基于SpringBoot2.0+Actuatormetrics的监控(基于OracleJDK9,G1)引言SpringBoot2在spring-boot-actuator中引入了micrometer,对1.x的metrics进行了重构,另外支持对接的监控系统也更加丰富(Atlas、Datadog、Ganglia、Graphite、Influx、JMX、NewRelic、Prometheus、SignalFx、StatsD、Wavefront)。本文以Prometheus为例阐述SpringBo

  • 拉姆达表达式启动一个线程

    拉姆达表达式启动一个线程publicstaticvoidmain(String[]args){Mythreadmythread=newMythread();newThread(()-&gt;mythread.r()).start();}staticclassMythread{publicvoidr(){intcount=0;for(inti=0;i&lt;=100;i++){S…

  • html显示当前脚本错误,访问网页总是提示当前网页脚本发生错误怎么办?「建议收藏」

    html显示当前脚本错误,访问网页总是提示当前网页脚本发生错误怎么办?「建议收藏」很多用户现在还在使用IE浏览器来浏览网页,不过最近有用户反映在访问网页的过程中弹出“脚本错误”的提示框,提示当前页面的脚本发生错误,这是怎么回事呢?出现这种情况的原因是用户使用的浏览器不能完全支持页面里的脚本,该如何解决此问题呢?方法一:清除IE缓存1、清除IE浏览器的缓存,点击工具》Internet选项,然后点击Internet删除文件(勾选删除所有脱机内容),之后重新打开IE浏览器,同时确认并…

发表回复

您的电子邮箱地址不会被公开。

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