Snark and Philip are preparing the problemset for the upcoming pre-qualification round for semi-quarter-finals. They have a bank of n problems, and they want to select any non-empty subset of it as a problemset.

k experienced teams are participating in the contest. Some of these teams already know some of the problems. To make the contest interesting for them, each of the teams should know at most half of the selected problems.

Determine if Snark and Philip can make an interesting problemset!

Input

The first line contains two integers n, k (1 ≤ n ≤ 105, 1 ≤ k ≤ 4) — the number of problems and the number of experienced teams.

Each of the next n lines contains k integers, each equal to 0 or 1. The j-th number in the i-th line is 1 if j-th team knows i-th problem and 0 otherwise.

Output

Print "YES" (quotes for clarity), if it is possible to make an interesting problemset, and "NO" otherwise.

You can print each character either upper- or lowercase ("YeS" and "yes" are valid when the answer is "YES").

Examples
Input
5 3
1 0 1
1 1 0
1 0 0
1 0 0
1 0 0
Output
NO
Input
3 2
1 0
1 1
0 1
Output
YES
在 n 道题目中挑选一些使得所有人对题目的掌握情况不超过一半。
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
bool vis[];
int main(){
int n,k,x;
scanf("%d%d",&n,&k);
for(int i=;i<=n;++i) {
int sum=;
for(int j=;j<=k;++j) {
scanf("%d",&x);
if(x) sum+=<<(j-);
}
vis[sum]=;
}
bool flag=;
for(int i=;i<=;++i) for(int j=;j<=;++j) if(((i&j)==)&&vis[i]&&vis[j]) flag=;
if(flag) puts("YES");else puts("NO");
}

最新文章

  1. iOS系统网络抓包方法
  2. java打jar包,引用其他.jar文件
  3. JSP知识
  4. HDFS
  5. youku的视频代码放到网站上如何实现自适应
  6. git分支使用
  7. 蚂蚁【A001】
  8. Spring 读书笔记-----使用Spring容器(一)
  9. C#中判断空字符串的3种方法性能分析
  10. sql 建立数据库,表格,索引,主键
  11. 喜大本\\ u0026普,微软的开源
  12. Java基本数据类型及其封装器的一些千丝万缕的纠葛
  13. Java经典编程题50道之三十九
  14. 基于ECharts的饼状数据展示
  15. IDEA修改显示星号*和热部署
  16. python learn note1
  17. 在新安装的Centos中安装python3.7 解决pip和yum问题
  18. postgres(pgAdmin) 客户端保存密码
  19. Chrome 不能访问tensorboard解决
  20. 20145331魏澍琛《网络对抗》Exp5 MSF基础应用

热门文章

  1. SpringBoot @ConfigurationProperties详解
  2. QML-密码管理器
  3. Hardware Introduction
  4. 洛谷P1217 回文质数
  5. MySQL高级(十三)--- 表锁
  6. 一只简单的网络爬虫(基于linux C/C++)————利用正则表达式解析页面
  7. ZABBIX自动发现Redis端口并监控
  8. 在html中使用vue组件
  9. 编程坑太多,Map 集合怎么也有这么多坑?一不小心又踩了好几个!
  10. js 箭头函数不适用的场景