10 条题解

  • 1
    @ 2026-7-13 18:05:50

    想当年(2023)做出这道题之后张正标老师请我们吃了披萨哈哈哈,现在都2026年了,我也老了(13岁

    #include<cmath>
    #include<iomanip>
    #include <string>
    #include <algorithm>
    #define LL long long
    using namespace std;
    int INF=0x3f3f3f3f;
    const int N=1e5+10;
    int t,n,z,c,ans=1;//000000也行
    int xz[62];
    bool dzy(int m)
    {
        for(int i=1;i<=n;i++)
        {
            if((m&xz[i])==xz[i])
                return 0;
        }
        return 1;
    }
    int main()
    {
        cin>>t>>n;
        for(int i=1;i<=n;i++)
        {
            cin>>z;
            for(int j=1;j<=z;j++)
            {
                cin>>c;
                xz[i]=xz[i]|(1<<(c-1));
                
            }
        }
        for(int i=1;i<=(1<<t)-1;i++)
        {
            if(dzy(i))
                ans++;
        }
        cout<<ans;
        return 0;
    }
    
    

    信息

    ID
    2549
    时间
    1000ms
    内存
    256MiB
    难度
    5
    标签
    递交数
    257
    已通过
    95
    上传者