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


相关推荐

  • python开发环境搭建,pycharm安装运行[通俗易懂]

    python开发环境搭建,pycharm安装运行[通俗易懂]一、python安装指南首先我们安装python1、进入官方网站(网址:https://www.python.org/downloads),根据自己的需求选择python的版本,这里我是选择的Python3.7.3,点击DownloadPython3.7.3按钮2、下载完成后点击安装文件包3、双击EXE文件进行安装,如下…

    2022年8月28日
    5
  • IntelliJ IDEA中创建java项目

    IntelliJ IDEA中创建java项目IntelliJIDEA支持java、Android、Maven、Gradle、Kotlin等类型的项目,同时AndroidStudio就是在其基础上二次开发出来的,功能非常强大。本文以IntelliJIDEA2018.2.5版本为例介绍如何创建java项目。1.依次选择菜单:File->New->Project…,打开NewProject界面。2.在左侧的项目类型里选择:Java,点击Next按钮。3.在出现的界面中选中“Createprojectfromtempl

    2022年7月8日
    41
  • SPI 协议详解_cifs协议

    SPI 协议详解_cifs协议SPI协议详解1、SPI简介2、SPI四线3、SPI四种工作模式4、SPI时序图1、SPI简介SPI全称是SerialPerripheralInterface,也就是串行外围设备接口。SPI是Motorola公司推出的一种同步串行接口技术,是一种高速、全双工的同步通信总线,SPI时钟频率相比I2C要高很多,最高可以工作在上百MHz。SPI以主从方式工作,通常是有一个主设备和一个或多个从设备,一般SPI需要4根线,但是也可以使用三根线(单向传输)2、SPI四线

    2022年10月15日
    3
  • qt报错lnk2019_2019咬文嚼字十大错误

    qt报错lnk2019_2019咬文嚼字十大错误Qt错误:LNK2019:无法解析的外部符号原因及解决办法删除Qt中的一些用不到的函数或者添加一个新的.ui窗口的时候,我遇到了这个LINK2019无法解析的外部符号错误,网上查了半天可算解决了,写篇博客记录下。错误原因1:函数(一般是槽函数)在.h中声明,但却没有实现如图,我在自己的automatic.c文件中生成了一个按钮的点击处理函数,后面不想用了,把它删掉了,但是在automatic.h中忘记删掉声明了,于是系统编译报错。所以删掉声明就好。错误原因2:添加新的.ui窗体文件时编

    2022年10月6日
    3
  • PyCharm激活码永久有效PyCharm2019.3.5激活码教程-持续更新,一步到位

    PyCharm激活码永久有效PyCharm2019.3.5激活码教程-持续更新,一步到位PyCharm激活码永久有效2019.3.5激活码教程-Windows版永久激活-持续更新,Idea激活码2019.3.5成功激活

    2022年6月19日
    81
  • oracle错误 904,EXP-00008: ORACLE error 904 encountered的解决方法「建议收藏」

    oracle错误 904,EXP-00008: ORACLE error 904 encountered的解决方法「建议收藏」EXP-00008:ORACLEerror904encountered的解决方法发表于:2007-06-22来源:作者:点击数:标签:【错误情况】[oracle@ccdevsvradmin]$expwmap/pass@jackeydbExport:Release8.1.7.4.0-ProductiononFriOct811:28:372004(c)Co…

    2025年12月7日
    11

发表回复

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

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