纯粹练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

CodeForces 441 A. Valera and Antique Items的更多相关文章

  1. Codeforces Round #252 (Div. 2) A - Valera and Antique Items

    水题 #include <iostream> #include <set> #include <vector> #include <algorithm> ...

  2. Codeforces 441 B. Valera and Fruits

    B. Valera and Fruits time limit per test 1 second memory limit per test 256 megabytes input standard ...

  3. Codeforces441A_Valera and Antique Items(水题)

    Valera and Antique Items time limit per test 1 second memory limit per test 256 megabytes input stan ...

  4. Codeforces#441 Div.2 四小题

    Codeforces#441 Div.2 四小题 链接 A. Trip For Meal 小熊维尼喜欢吃蜂蜜.他每天要在朋友家享用N次蜂蜜 , 朋友A到B家的距离是 a ,A到C家的距离是b ,B到C ...

  5. Codeforces 396 E. Valera and Queries

    题目链接:http://codeforces.com/problemset/problem/369/E 考虑将问题转化为有多少条线段没有覆盖这些点,如果一个询问的点集是${[x1,x2,...,xn] ...

  6. CodeForces - 441D: Valera and Swaps(置换群)

    A permutation p of length n is a sequence of distinct integers p1, p2, ..., pn (1 ≤ pi ≤ n). A permu ...

  7. Codeforces 369 C Valera and Elections

    Valera and Elections 题意:现在有n个候选人, 有n-1条路, 如果选择了这个候选人, 这个候选人就会将从自己这个城市到1号城市上所有坏的路都修复一下,现在求最小的候选人数目, 如 ...

  8. codeforces #441 B Divisiblity of Differences【数学/hash】

    B. Divisiblity of Differences time limit per test 1 second memory limit per test 512 megabytes input ...

  9. 【Codeforces 369C】 Valera and Elections

    [链接] 我是链接,点我呀:) [题意] 给你一棵树 让你选择若干个修理点. 这些修理点被选中之后,节点i到1号节点之间的所有"坏路"都会被修好 问最少需要选择多少个点才能将所有的 ...

随机推荐

  1. 使用psftp.exe

    使用psftp.exe 点击打开psftp.exe,出现如下图的命令窗口.  

  2. J2EE的13个规范之JDBC

    假设让你接触一样新的东西.你可能感觉无所适从,可是假设本来就是旧事物的话,你学习起来还难吗? 一.ODBC,我们的老朋友 ODBC(Open Database Connectivity)是微软公司与数 ...

  3. memcached 分布式聚类算法

    memcached 分布式集群,该决定必须书面开发商自己.和redis 由分布式server决定.上 memcached 有两个选项用于分布式.第一个是:模运算 另一种是:一致性hash 分布式算法. ...

  4. Linux/Unix使用valgrind内存泄漏检测

    c\c++程序设计.内存管理是一个比较头疼的问题.相信它会导致内存泄漏.除了外部养成良好的编程习惯(使用智能指针),使用该工具还可以帮助检测内存泄漏,valgrind这是Unix\Linux在一个很好 ...

  5. Oracle SQL Lesson (11) - 创建其他数据库对象(试图/序列/索引/同义词)

    schema(模式)一个用户下一组对象的集合,一般与用户名一致. 视图 CREATE [OR REPLACE] [FORCE|NOFORCE] VIEW view [(alias[, alias].. ...

  6. LightOj 1148 Basic Math

    1148 - Mad Counting PDF (English) Statistics Forum Time Limit: 0.5 second(s) Memory Limit: 32 MB Mob ...

  7. 移植 libuv 至 Visual C++ 6.0 并支持 Windows XP 编译系统

    移植版本 libuv:https://github.com/liigo/libuv-vc6 (支持VC6和XP.作者Liigo). 我从一年前(大概2013年6,7月份)開始在业余时间做这项移植工作, ...

  8. 源代码分析:LayoutParams的wrap_content, match_parent, 而详细的价值观

    问题: 慢慢地熟悉android 的过程中.发现view 要么layout初始化,建或者生产活动是很清楚.被添加到父控制,然后开始了相应的生命周期.但父控件的整个界面.还是第一个系统view. 怎么来 ...

  9. Sublime Text 3 最性感的编辑历史

    ↑ ↑ ↑ ↑ ↑ 请参阅文件夹 ↑ ↑ ↑ ↑ ↑ 下载 / 装 windows / MAC OS 官网下载.双击安装,这个都会吧- linux linux下安装.一种办法是从官网下载 tar.bz ...

  10. aspx向silverlight传值

    原文:http://www.cnblogs.com/lensso/archive/2010/07/27/1785844.html 方法1: 向嵌入aspx页面的silverlight对象添加imnit ...