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


相关推荐

  • mybatis拦截器执行顺序配置_springmvc拦截器执行顺序

    mybatis拦截器执行顺序配置_springmvc拦截器执行顺序1.原始jdbc工作流程原始jdbc工作流程以查询为例1加载驱动Class.forName(Driver.class.getName())2建立数据库连接Connectionroot=DriverManager.getConnection(“xx”,“xx”,“xx”)3预编译sql语句PreparedStatementpreparedStatement=root.prepareStatement(sql)4占位符参数赋值preparedSt

    2025年9月5日
    5
  • 预格式化文本pre标签

    预格式化文本pre标签pre 元素可定义预格式化的文本 被包围在 pre 元素中的文本通常会保留空格和换行符 而文本也会呈现为等宽字体 pre 标签的一个常见应用就是用来表示计算机的源代码 演示 pre 此例演示如何使用 pre 标签对空行和空格进行控制 pre 效果如下 此例演示如何使用 pre 标签对空行和空格进行控制所谓的预格式化文本就是 按照我们预先写好的文字格式 pre

    2026年3月17日
    2
  • MapReduce程序依赖的jar包[通俗易懂]

    MapReduce程序依赖的jar包

    2022年1月29日
    48
  • fdfs安装

    fdfs安装我这个看这懵逼结合起来看就蒙了下面俩路径 https my oschina net tshblogs blog 安装 FastDFS 服务器安装文件 fastdfs nginx module v1 16 tar gzlibfastcom master zipFastDFS v5 08 tar gzlibevent 2 0 22 stable tar gz

    2026年3月26日
    2
  • Springboot源码_pe启动制作源码

    Springboot源码_pe启动制作源码我们在使用SpringBoot启动项目的时候,可能只需加一个注解,然后启动main,整个项目就运行了起来,但事实真的是所见即所得吗,还是SpringBoot在背后默默做了很多?本文会通过源码解析的方式深入理解SpringBoot启动全过程SpringBoot启动过程流程图源码解析大家不要抗拒源码解析,这个非常优秀的代码,我们如果能够学会对自己代码编写水平大有裨益首先,我们先来看下SpringBoot项目的启动类@SpringBootApplicationpublicclassSp.

    2022年8月21日
    7
  • 怎么开启小米Note 3的root超级权限

    怎么开启小米Note 3的root超级权限小米 Note3 有没有办法获得 Root 权限 我们都知道 android 设备有 Root 权限 一旦手机获得 root 相关权限 就能够实现更好的功能 举个栗子我们单位的营销部门的妹纸 使用一些营销工具都需要在 Root 权限下工作 如果手机无能获的 root 的权限 就没办法正常使用相关的功能 小米 Note3 开发版系统版本本身拥有 root 权限管理工具 但是如果你使用的是小米 Note3 稳定版 建议可以先将小

    2026年3月17日
    2

发表回复

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

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