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)
上一篇 2022年1月9日 上午8:00
下一篇 2022年1月9日 上午9:00


相关推荐

  • Django框架—目录文件简介

    1.创建工程2.工程目录结构3.各文件作用:1manage.py2init.py3settings.py该Django项目(此处是mysite)的设置文件或配置文件。 重要

    2022年3月29日
    55
  • mt4软件下载使用_安卓手机如何下载mt4

    mt4软件下载使用_安卓手机如何下载mt4现在要投资理财非常的方便,投资者只要通过交易软件就可以线上完成这个过程。不得不承认,一款好的交易软件确实能让投资者获得更好的体验,而一款品质较差的软件不仅会让交易不顺,甚至会让投资者错失盈利机会。目前市面上主流的交易软件就是mt4,那mt4软件怎么选对下载方式?在正规安全平台下载mt4软件mt4的下载方式很多,一些没有经验的投资者可能会“下错”软件,比如在一些正规性上存在问题的网站下载了mt4软件,这就很有可能会使自己的交易暴露在严重的风险中。那正版mt4。cnca。ink软件在哪里下载更安全呢?为了避

    2022年8月15日
    7
  • 宝马宣布与Mobileye合作,想让每辆车都成为行走的数据源

    宝马宣布与Mobileye合作,想让每辆车都成为行走的数据源

    2022年3月13日
    43
  • manus如何安装

    manus如何安装

    2026年3月13日
    2
  • 原码反码补码的相互转换_补码转化为反码

    原码反码补码的相互转换_补码转化为反码原码反码补码的相互转换原码反码补码的转换还是比较简单基础的问题。之前学习java的时候就学过,后来忘记了,忘记了!!!,后来学了位移运算符,左移右移无符号右移之后就由有点儿懵了。原码,反码,补码二进制中第一位是符号位,0表示正数,1表示负数。以八位二进制数为例。原码十进制数正1的二进制原码[+1]原=00000001十进制数负1的二进制原码[-1]原…

    2025年6月29日
    3
  • opencv 特征值_直方图阈值图像分割

    opencv 特征值_直方图阈值图像分割1、简单阈值设置像素值高于阈值时,给这个像素赋予一个新值(可能是白色),否则我们给它赋予另外一种颜色(也许是黑色)。这个函数就是cv2.threshhold()。这个函数的第一个参数就是原图像,原

    2022年8月1日
    13

发表回复

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

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