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 输入两个实数,判断第一个数大 ...
随机推荐
- 通过POST请求上传文件
转自:https://blog.csdn.net/zhangge3663/article/details/81218488 理论 简单的HTTP POST 大家通过HTTP向服务器发送POST请求提交 ...
- Rest架构下的增删改查
首先还是要连接一下什么是Rest, REST是英文representational state transfer(表象性状态转变)或者表述性状态转移;Rest是web服务的一种架构风格;使用HTTP, ...
- 如鹏网学习笔记(十一)JQuery
一.jQuery简介 jQuery是一个JavaScript库,特性丰富,包含若干对象和很多函数,可以替代传统DOM编程的操作方式和操作风格 jQuery通过对DOM API.DOM事件的封装,提供了 ...
- Docker学习之Docker镜像基本使用
Docker学习之Docker镜像基本使用 获取镜像 命令格式:docker pull [选项] [Docker Registry 地址[:端口号]/]仓库名[:标签] 例如: docker pull ...
- C++ 语法积累20161015
1.break 作用:用于终止当前循环(跳出循环体). 遇到最多的应该是在双层循环体中的使用: (1)在内循环体中,遇到break,则直接跳出内循环体,再次执行外循环体. (2) 在外循环体中,bre ...
- 6、Object、String、StringBuffer
Java的Api以及Object类 API概念 * A:API(Application Programming Interface) * 应用程序编程接口 * B:Java API * 就是Java提 ...
- 撩课-Python-每天5道面试题-第7天
一. 函数的返回值的概念,语法以及注意事项? 场景 当我们通过某个函数, 处理好数据之后, 想要拿到处理的结果 语法 def 函数(): 函数体 return 数据 注意事项 3.1 return 后 ...
- 02-Http请求与响应全解
什么是协议 约束双方规范的一个准则 什么是HTTP协议 HTTP,超文本传输协议(HyperText Transfer Protocol)是互联网上应用最为广泛的一种网络协议 所有的WWW文件都必须遵 ...
- JavaScript根据国家二字码获取国家全称
function getCountryNameByCode(code) { var countryName = ''; switch(code) { case "US": coun ...
- HDU 2680(最短路)(多个起始点)
这道题也是死命TLE.. http://acm.hdu.edu.cn/showproblem.php?pid=2680 /* 使用pair代替结构 */ #include <iostream&g ...