F - Qualification Rounds CodeForces - 868C binary

F - Qualification Rounds

 CodeForces - 868C 

The subject does not, check the internet a bit and found a conclusion that if it is possible, then the two certainly met.

Then press down to this binary state on it.

#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <vector>
#include <iostream>
#include <string>
#define inf 0x3f3f3f3f
#define inf64 0x3f3f3f3f3f3f3f3f
using namespace std;
const int maxn = 1e5 + 10;
typedef long long ll;
bool vis[100];
int main()
{
	int n, m, flag = 0;
	scanf("%d%d", &n, &m);
	int sum = (1 << m);
	for(int i=1;i<=n;i++)
	{
		int now = 0;
		for(int j=1;j<=m;j++)
		{
			int x;
			scanf("%d", &x);
			if (x) now |= (1 << (j - 1));
		}
		vis[now] = 1;
	}
	for(int i=0;i<sum;i++)
	{
		if (vis[i] == 0) continue;
		for(int j=0;j<sum;j++)
		{
			if (vis[j] == 0) continue;
			if ((i&j) == 0) flag = 1;
		}
	}
	if (flag) printf("YES\n");
	else printf("NO\n");
	return 0;
}

  

Guess you like

Origin www.cnblogs.com/EchoZQN/p/11404136.html