abc356_c 求调#8WA
  • 板块学术版
  • 楼主CASCwty
  • 当前回复1
  • 已保存回复1
  • 发布时间2024/6/8 11:35
  • 上次更新2024/6/8 14:19:31
查看原帖
abc356_c 求调#8WA
761444
CASCwty楼主2024/6/8 11:35

abc356_c的第八个点WA了,救救我!

#include<bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl '\n'
#define int long long
int n,m,k;
int vis[110][110];
int key[110];
int ans=0;
void check(int x)
{
	int wei=0,tf=0;
	int cntt=0;
	while(x)
	{
		wei++;
		tf=x%2;
		if(tf)cntt++;
		x/=2;
		key[wei]=tf;
	}
	if(cntt<k)return;
	//for(int i=1;i<=n;i++)cout<<key[i]<<" ";
	//cout<<endl;
	for(int i=1;i<=m;i++)
	{
		int tt=0,ff=0;
		for(int j=1;j<=n;j++)
		{
			//cout<<vis[i][j]<<" ";
			if(vis[i][j]==2 && key[j]==1)ff++;
			if(vis[i][j]==1 && key[j]==1)tt++;
		}
		//cout<<endl;
		//cout<<tt<<":"<<ff<<endl;
		if(ff>=k && ff!=0)return;
		if(tt<k && tt!=0)return;
	}
	ans++;
}
signed main()
{
	IOS
	cin>>n>>m>>k;
	for(int i=1;i<=m;i++)
	{
		int cccc;
		cin>>cccc;
		for(int j=1;j<=cccc;j++)
		{
			cin>>key[j];
		}
		char typ;
		cin>>typ;
		int fuzhi=0;
		if(typ=='o')
			fuzhi=1;
		else if(typ=='x')fuzhi=2;
		for(int j=1;j<=cccc;j++)
			vis[i][key[j]]=fuzhi;
	}
	for(int i=0;i<(1<<n);i++)
	{
		memset(key,0,sizeof(key));
		check(i);
	}
	cout<<ans;
	return 0;
 }
2024/6/8 11:35
加载中...