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
  1. 3 50000
  2. 1 40000
  3. 2 20000 60000
  4. 3 10000 70000 190000
output
  1. 3
  2. 1 2 3
input
  1. 3 50000
  2. 1 50000
  3. 3 100000 120000 110000
  4. 3 120000 110000 120000
output
  1. 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.

解题报告

切水题。

  1. #include <iostream>
  2. #include <cstdio>
  3. #include <cstring>
  4. using namespace std;
  5. int n,v,hashh[10000],k,s;
  6. int main()
  7. {
  8. int i,j;
  9. while(cin>>n>>v)
  10. {
  11. memset(hashh,0,sizeof(hashh));
  12. for(i=1; i<=n; i++)
  13. {
  14. cin>>k;
  15. for(j=0; j<k; j++)
  16. {
  17. cin>>s;
  18. if(s<v)
  19. hashh[i]=1;
  20. }
  21. }
  22. int cnt=0;
  23. for(i=1; i<=n; i++)
  24. {
  25. if(hashh[i])
  26. {
  27. cnt++;
  28. }
  29. }
  30. printf("%d\n",cnt);
  31. for(i=1;i<n;i++)
  32. {
  33. if(hashh[i])
  34. {
  35. printf("%d ",i);
  36. }
  37. }
  38. if(hashh[n])
  39. printf("%d",n);
  40. printf("\n");
  41. }
  42. return 0;
  43. }

Codeforces441A_Valera and Antique Items(水题)的更多相关文章

  1. Poj 1552 Doubles(水题)

    一.Description As part of an arithmetic competency program, your students will be given randomly gene ...

  2. codeforces 569B B. Inventory(水题)

    题目链接: B. Inventory time limit per test 1 second memory limit per test 256 megabytes input standard i ...

  3. HDOJ 2317. Nasty Hacks 模拟水题

    Nasty Hacks Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Tota ...

  4. ACM :漫漫上学路 -DP -水题

    CSU 1772 漫漫上学路 Time Limit: 1000MS   Memory Limit: 131072KB   64bit IO Format: %lld & %llu Submit ...

  5. ytu 1050:写一个函数,使给定的一个二维数组(3×3)转置,即行列互换(水题)

    1050: 写一个函数,使给定的一个二维数组(3×3)转置,即行列互换 Time Limit: 1 Sec  Memory Limit: 128 MBSubmit: 154  Solved: 112[ ...

  6. [poj2247] Humble Numbers (DP水题)

    DP 水题 Description A number whose only prime factors are 2,3,5 or 7 is called a humble number. The se ...

  7. gdutcode 1195: 相信我这是水题 GDUT中有个风云人物pigofzhou,是冰点奇迹队的主代码手,

    1195: 相信我这是水题 Time Limit: 1 Sec  Memory Limit: 128 MBSubmit: 821  Solved: 219 Description GDUT中有个风云人 ...

  8. BZOJ 1303 CQOI2009 中位数图 水题

    1303: [CQOI2009]中位数图 Time Limit: 1 Sec  Memory Limit: 162 MBSubmit: 2340  Solved: 1464[Submit][Statu ...

  9. 第十一届“蓝狐网络杯”湖南省大学生计算机程序设计竞赛 B - 大还是小? 字符串水题

    B - 大还是小? Time Limit:5000MS     Memory Limit:65535KB     64bit IO Format: Description 输入两个实数,判断第一个数大 ...

随机推荐

  1. Cannot find module 'rxjs/operators/share'

    描述: ionic项目,在使用了ngx-translate之后,项目编译完成,运行到浏览器时,出现如下错误: 其中ngx-translate参照官网最新教程使用,并且也尝试了angular4.3之前的 ...

  2. RabbitMQ---5、远程 IP 访问

    刚刚安装的RabbitMQ-Server-3.3.7,并且也已经开启了Web管理功能,但是现在存在一个问题: 出于安全的考虑,guest这个默认的用户只能通过http://localhost:1567 ...

  3. 启动Hadoop时候datanode没有启动的原因及解决方案

    有时候我们start-dfs.sh启动了hadoop但是发现datanode进程不存在 一.原因 当我们使用hadoop namenode -format格式化namenode时,会在namenode ...

  4. Spring 中的Enum HttpStatus 及HTTP状态码

    官方API https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/http/HttpStatus.htm ...

  5. JAVA基础之——使用idea创建maven项目 以及使用tomcat本地调试springmvc

    前言:关于这个话题网上有很多,本文旨在引导实战纠偏,理论偏少,如果按照步骤还不能达到本文目的,请留言. 1 环境准备 1.1 软件准备 idea:官方下载社区版,下载后安装 maven:Apache- ...

  6. Java与C++区别:重载(Overloading)

    Java中一个类的函数重载可以在本类中的函数和来自父类中的函数之间进行,而C++类中的函数重载只能是本类中的(即不包括来自父类的函数),这是他们一个非常重要的区别.在其他方面的要求都是一致的,即要求函 ...

  7. Uncaught TypeError: timeout.close is not a function. when try to use clearInterval

    It's because of your IDE! Make sure you have added automatic imports such as import { clearInterval ...

  8. C++创建一个新的进程

    原文:http://blog.csdn.net/hk627989388/article/details/53309865 STARTUPINFO用于指定新进程的主窗口特性的一个结构. PROCESS_ ...

  9. php下载远程大文件(获取远程文件大小)

    function download_file($url) { // $url = http://192.168.8.95/vm/download_file?downurl=http://192.168 ...

  10. linux_day3

    1.grep与find的区别? grep是查找文件内的字符而find则是查找文件 2.显示/etc/passwd中以nologin结尾的行 3. 输入ip addr命令后,过滤出包含ip的行 ip a ...