Codeforces441A_Valera and Antique Items(水题)
1 second
256 megabytes
standard input
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.
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.
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.
3 50000
1 40000
2 20000 60000
3 10000 70000 190000
3
1 2 3
3 50000
1 50000
3 100000 120000 110000
3 120000 110000 120000
0
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.
解题报告
切水题。
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int n,v,hashh[10000],k,s;
int main()
{
int i,j;
while(cin>>n>>v)
{
memset(hashh,0,sizeof(hashh));
for(i=1; i<=n; i++)
{
cin>>k;
for(j=0; j<k; j++)
{
cin>>s;
if(s<v)
hashh[i]=1;
}
}
int cnt=0;
for(i=1; i<=n; i++)
{
if(hashh[i])
{
cnt++;
}
}
printf("%d\n",cnt);
for(i=1;i<n;i++)
{
if(hashh[i])
{
printf("%d ",i);
}
}
if(hashh[n])
printf("%d",n);
printf("\n");
}
return 0;
}
Codeforces441A_Valera and Antique Items(水题)的更多相关文章
- Poj 1552 Doubles(水题)
一.Description As part of an arithmetic competency program, your students will be given randomly gene ...
- codeforces 569B B. Inventory(水题)
题目链接: B. Inventory time limit per test 1 second memory limit per test 256 megabytes input standard i ...
- HDOJ 2317. Nasty Hacks 模拟水题
Nasty Hacks Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Tota ...
- ACM :漫漫上学路 -DP -水题
CSU 1772 漫漫上学路 Time Limit: 1000MS Memory Limit: 131072KB 64bit IO Format: %lld & %llu Submit ...
- ytu 1050:写一个函数,使给定的一个二维数组(3×3)转置,即行列互换(水题)
1050: 写一个函数,使给定的一个二维数组(3×3)转置,即行列互换 Time Limit: 1 Sec Memory Limit: 128 MBSubmit: 154 Solved: 112[ ...
- [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 ...
- gdutcode 1195: 相信我这是水题 GDUT中有个风云人物pigofzhou,是冰点奇迹队的主代码手,
1195: 相信我这是水题 Time Limit: 1 Sec Memory Limit: 128 MBSubmit: 821 Solved: 219 Description GDUT中有个风云人 ...
- BZOJ 1303 CQOI2009 中位数图 水题
1303: [CQOI2009]中位数图 Time Limit: 1 Sec Memory Limit: 162 MBSubmit: 2340 Solved: 1464[Submit][Statu ...
- 第十一届“蓝狐网络杯”湖南省大学生计算机程序设计竞赛 B - 大还是小? 字符串水题
B - 大还是小? Time Limit:5000MS Memory Limit:65535KB 64bit IO Format: Description 输入两个实数,判断第一个数大 ...
随机推荐
- RabbitMQ入门教程系列
https://blog.csdn.net/column/details/18247.html
- C# 之文件拖拽和pixturBox缩放与拖拽
文件拖拽: 效果:将一个文件拖拽到窗体的某个控件时,将该控件的路径显示在该控件上,只要拿到了路径自然可以读取文件中的内容了. 将一个控件的属性AllowDrop设置为true,然后添加DragDrop ...
- 【转】Java Spring AOP详解
一.前言 在以前的项目中,很少去关注spring aop的具体实现与理论,只是简单了解了一下什么是aop具体怎么用,看到了一篇博文写得还不错,就转载来学习一下,博文地址:http://www.cnbl ...
- Java基础教程(4)--面向对象概念
如果你之前从来没有使用过面向对象编程语言,那么在学习Java之前需要先理解几个有关面向对象编程的基本概念.这篇教程将会向你介绍对象.类.集成.接口和包的概念,以及这些概念是如何与现实世界相关联,并 ...
- 03-Tomcat服务器
一.Java分类 JavaSE Java的标准版,一般用来开发桌面应用程序, 但是在开发桌面应用程序上相对VB,Delphi,VC++并没有什么优势. JavaEE 也就是Java Enterpris ...
- windbg .net 程序的死锁检测 常用方法(个人备份笔记)
//死锁检测 .load sosex.dll :> !dlk :> !mk -a The mk command displays a call stack of the currently ...
- scrum 项目的基本模式
scrum 项目中有 3 个主要的角色:产品所有者, Scrum 主管和团队成员 产品所有者和团队其他成员一起工作,负责维护生产积压工作表 (production backlog) ,并对表中的项制定 ...
- hdu2044 一只小蜜蜂
和之前的楼梯题一样,递推求解 但是要注意这里可以到50,结果已经超出了Int的范围,所以要用64位保存 #include<iostream> #include<cmath> # ...
- Java集合 之Map(HashMap、Hashtable 、TreeMap、WeakHashMap )理解(new)
HashMap 说明: 在详细介绍HashMap的代码之前,我们需要了解:HashMap就是一个散列表,它是通过“拉链法”解决哈希冲突的.还需要再补充说明的一点是影响HashMap性能的有两个参数:初 ...
- Thymeleaf学习记录(3)--语法
语法: 标准表达式语法 简单表达: 变量表达式: ${...} 选择变量表达式: *{...} 消息表达式: #{...} 链接网址表达式: @{...} 字面 文本文字:'one text','An ...