Codeforces Round #438
来源:互联网 发布:机器小怪升级数据 编辑:程序博客网 时间:2024/06/16 08:13
题意:
给你几个问题,和每个问题对于k个人他们所了不了解。
让你判断是否存在挑出任意几个问题,能让这k个人最多只了解这些问题的一半。
POINT:
答案必为挑2个问题组合,状态压缩一下。
#include <iostream>#include <string.h>#include <stdio.h>#include <map>#include <algorithm>using namespace std;#define LL long longconst int maxn = 20;map<int,int>mp;int main(){ int n,k; scanf("%d %d",&n,&k); int cnt[maxn]; int num=0; for(int i=1;i<=n;i++){ int now=0; for(int j=0;j<k;j++){ int a; scanf("%d",&a); if(a==1) now=now|(1<<j); } if(mp[now]==0){ mp[now]=1; cnt[++num]=now; } } for(int i=1;i<=num;i++){ for(int j=1;j<=num;j++){ int now=0; for(int s=0;s<=k;s++){ now=now|((cnt[i]>>s)&(cnt[j]>>s)); } if(now==0){ printf("YES\n"); return 0; } } } printf("NO\n");}
阅读全文
0 0
- Codeforces Round #438 题解
- Codeforces Round #438 题解
- Codeforces Round #438 B
- Codeforces Round #438
- Codeforces Round #438
- Codeforces Round #438
- Codeforces Round #438
- 【codeforces】Codeforces Round #363
- Codeforces Round #438 C. Qualification Rounds
- Codeforces Round #438 868A/B/C
- Codeforces Round #438 C. Qualification Rounds 二进制
- Codeforces Round #438 A. Bark to Unlock
- Codeforces Round #438 B. Race Against Time
- codeforces round #438 C. Qualification Rounds
- Codeforces Round #438 C. Qualification Rounds 题解
- Codeforces Round #438 C. Qualification Rounds
- Codeforces Round #270 Codeforces Round #270
- 【Codeforces】Codeforces Round #271 div2
- bzoj 4542: [Hnoi2016]大数
- POJ 1523 浅谈无向图TarJan连通块割顶分割技术
- BZOJ 4742: [Usaco2016 Dec]Team Building ——DP
- java 大整数运算Integer Inquiry HDU
- [BeiJing2006]狼抓兔子
- Codeforces Round #438
- 数据结构及算法(Python)---单链表
- HDU 1874 畅通工程续
- HTML元素——文本格式化元素
- bzoj1009 GT考试(AC自动机+DP+矩阵快速幂)
- 随笔思考
- ACM-10月12日周四周中训练日记
- 基于MAC的SeetaFace安装与测试(一)
- sublime text3 注册码