#include<iostream>
#include<stdio.h>
#include<algorithm>
#define MAXN 105
using namespace std; int a[MAXN];
bool Binarry_search(int a[],int size,int num); bool binarry_search(int a[],int num,int low,int high);
int main()
{
//freopen("acm.acm","r",stdin);
int cous;
int cate;
int c;
int r;
int i;
int j;
int tem;
int test;
bool boo;
while(scanf("%d%d",&cous,&cate),cous)
{
boo = false;
test = ;
for(i = ; i < cous; ++ i)
{
scanf("%d",&a[i]);
}
sort(a,a+cous);
for(i = ;i < cate; ++ i)
{
scanf("%d%d",&c,&r);
for(j = ; j < c; ++ j)
{
scanf("%d",&tem);
if(binarry_search(a,tem,,cous-))
++ test;
}
if(test < r)
{
boo = true;
}
test = ;
}
if(!boo)
cout<<"yes"<<endl;
else
cout<<"no"<<endl;
}
} ////////////////////////////////////////////////////////////////////////////////////////
//· Binarry_search_algorithm ·//
////////////////////////////////////////////////////////////////////////////////////////
bool Binarry_search(int a[],int size,int num)
{
int i;
int low = ;
int high = size -;
int mid;
while(low <= high)
{
mid = (low + high)/;
if(num < a[mid])
{
high = mid - ;
}
else if(num > a[mid])
{
low = mid + ;
}
else
return true;
}
return false;
} bool binarry_search(int a[],int num,int low,int high)
{
int mid;
mid = (low + high)/;
if(low > high)
return false;
if(num < a[mid])
binarry_search(a,num,low,mid - );
else if(num > a[mid])
binarry_search(a,num,mid + ,high);
else
return true; }

POJ 2664的更多相关文章

  1. POJ 2664 Prerequisites?(简单题)

    [题意简述]:k:已经选择的科目数:m:选择的科目类别:c:能够选择的科目数.r:要求最少选择的科目数量 在输入的k和m以下的一行是选择的科目号. 比如: 3 2 //3是他选择了3科.2表示选择了两 ...

  2. 【POJ - 2664】Prerequisites? (排序+查找)

    Prerequisites? 原文是English,这里直接就写中文吧 题意简述 k:已经选择的科目数:m:选择的科目类别:c:能够选择的科目数.r:要求最少选择的科目数量 在输入的k和m以下的一行是 ...

  3. POJ 3370. Halloween treats 抽屉原理 / 鸽巢原理

    Halloween treats Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 7644   Accepted: 2798 ...

  4. POJ 2356. Find a multiple 抽屉原理 / 鸽巢原理

    Find a multiple Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 7192   Accepted: 3138   ...

  5. POJ 2965. The Pilots Brothers' refrigerator 枚举or爆搜or分治

    The Pilots Brothers' refrigerator Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 22286 ...

  6. POJ 1753. Flip Game 枚举or爆搜+位压缩,或者高斯消元法

    Flip Game Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 37427   Accepted: 16288 Descr ...

  7. POJ 3254. Corn Fields 状态压缩DP (入门级)

    Corn Fields Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 9806   Accepted: 5185 Descr ...

  8. POJ 2739. Sum of Consecutive Prime Numbers

    Sum of Consecutive Prime Numbers Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 20050 ...

  9. POJ 2255. Tree Recovery

    Tree Recovery Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 11939   Accepted: 7493 De ...

随机推荐

  1. 2018.10.25 bzoj3928: [Cerc2014] Outer space invaders(区间dp)

    传送门 区间dpdpdp好题. 首先肯定需要把坐标离散化. 然后在数轴上面区间dpdpdp. 对于当前区间,区间中最大的数一定会被选. 于是我们记f[i,j]f[i,j]f[i,j]表示所有左端点在i ...

  2. Linux 目录说解

    目录 1.树状目录结构图 2./目录 3./etc/目录 4./usr/目录 5./var/目录 6./proc/目录 7./dev/目录 该文章主要来自于网络进行整理. 目录结构参考地址: http ...

  3. python模块:shutil

    """Utility functions for copying and archiving files and directory trees. XXX The fun ...

  4. hadoop sqoop的常用名命令

    1 列出所有的ambari数据库中所有的表 Sqoop list-tables -connect  jdbc:mysql://localhost:3306/ambari -username ambar ...

  5. shell脚本之正则表达式

    具体参考: www.jb51.net/tools/shell_regex.html 正则表达式常用于grep AWK 等工具中

  6. noip第7课资料

  7. java基础-day24

    第01天 java基础加强 今日内容介绍 u Junit单元测试及反射概述 u 反射操作构造方法.成员方法.成员属性 u properties的基本操作 u 综合案例 第1章   Junit单元测试及 ...

  8. Hdu3829 Cat VS Dog(最大独立点集)

    Cat VS Dog Problem Description The zoo have N cats and M dogs, today there are P children visiting t ...

  9. 微信小程序-flex布局中align-items和align-self区别

    首先看看菜鸟教程中关于align-items和align-self的定义 align-items:align-items 属性定义flex子项在flex容器的当前行的侧轴(纵轴)方向上的对齐方式.(对 ...

  10. 走上模拟道路 HDU4891

    http://vjudge.net/contest/view.action?cid=51327#problem/D Description Yoda: May the Force be with yo ...