Codeforces Round #252(Div. 2) 441A. Valera and Antique Items 水题
来源:互联网 发布:linux 获取文件行数 编辑:程序博客网 时间:2024/06/07 19:07
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 500001 400002 20000 600003 10000 70000 190000
31 2 3
3 500001 500003 100000 120000 1100003 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.
题意:RT
题解:
扫一遍,判断就是了。
/*****************PID:441a div2*Auth:Jonariguez******************/#define lson k*2,l,m#define rson k*2+1,m+1,r#define rep(i,s,e) for(i=(s);i<=(e);i++)#define For(j,s,e) For(j=(s);j<(e);j++)#define sc(x) scanf("%d",&x)#define In(x) scanf("%I64d",&x)#define pf(x) printf("%d",x)#define pfn(x) printf("%d\n",(x))#define Pf(x) printf("%I64d",(x))#define Pfn(x) printf("%I64d\n",(x))#define Pc printf(" ")#define PY puts("YES")#define PN puts("NO")#include <stdio.h>#include <string.h>#include <string>#include <math.h>#include <set>#include <map>#include <stack>#include <queue>#include <vector>#include <iostream>#include <algorithm>using namespace std;typedef long long LL;typedef int Ll;Ll quick_pow(Ll a,Ll b,Ll MOD){a%=MOD;Ll res=1;while(b){if(b&1)res=(res*a)%MOD;b/=2;a=(a*a)%MOD;}return res;}const int maxn=100000+10;vector<int> ans;int main(){ int i,j,n,m; while(scanf("%d%d",&n,&m)!=EOF){ int res=0; ans.clear(); for(i=1;i<=n;i++){ int k,x; scanf("%d%d",&k,&x); int y; for(j=1;j<k;j++){ sc(y);x=min(y,x); } if(m>x) ans.push_back(i); } printf("%d\n",ans.size()); for(i=0;i<ans.size();i++) printf("%d ",ans[i]); puts(""); } return 0;}
- Codeforces Round #252 (Div. 2)A. Valera and Antique Items
- Codeforces Round #252 (Div. 2) A. Valera and Antique Items
- Codeforces Round #252(Div. 2) 441A. Valera and Antique Items 水题
- Codeforces Round #252 (Div. 2) 441A Valera and Antique Items
- CodeForces 252A-Valera and Antique Items
- CodeForces 441 A. Valera and Antique Items
- CodeForces 441A Valera and Antique Items
- CodeForces 441A Valera and Antique Items
- codeforces 441A Valera and Antique Items
- A. Valera and Antique Items
- Codeforces Round #252 (Div. 2) 441B. Valera and Fruits
- Codeforces Round #252 (Div. 2) 441C. Valera and Tubes
- Codeforces Round #252 (Div. 2)441D. Valera and Swaps
- Codeforces Round #216 (Div. 2) A. Valera and Plates
- Codeforces Round #237 (Div. 2) A. Valera and X
- Codeforces Round #252 (Div. 2) C. Valera and Tubes
- Codeforces Round #252 (Div. 2)B. Valera and Fruits
- Codeforces Round #252 (Div. 2)-B. Valera and Fruits
- 第五周项目2-游戏中的角色类(1)
- UVa 10340, All in All
- 支付宝支付
- Codeforces--614A--Link/Cut Tree(数学)(暴力求解)
- 【Data Algorithms_Recipes for Scaling up with Hadoop and Spark】Chapter 12. K-Means Clustering
- Codeforces Round #252(Div. 2) 441A. Valera and Antique Items 水题
- java学习第六天
- 自定义ORM注解实现生成查询语句
- iOS框架学习
- Android AS平台jni环境配置
- MapReduce程序运行中的排序问题
- SDAU 1006
- 58 单例模式与auto_ptr
- oracle物理dg状态检查