Submission #35471827


Source Code Expand

#include <bits/stdc++.h>
const int MAXN = 1e2 + 10;
namespace trash_with_mode{
#define foe(i, now) for (int i = head[now]; ~i; i = edg[i].edg)
#define fo(i, g1, g2) for (int i = (g1), __Endi__ = (g2); i <= __Endi__; ++i)
#define fd(i, g1, g2) for (int i = (g1), __Endi__ = (g2); i >= __Endi__; --i)
#define go(v,now)     for (auto &v:edg[now])
#define mem(g1, g2) memset((g1), g2, sizeof((g1)))
#define lowbit(now) ((now) & (-now))
#define lson ((now) << 1)
#define mid ((l + r) / 2)
#define rson (lson | 1)
#define ll long long
#define pb push_back
#define mp(g1, g2) make_pair((g1), (g2))
#define PII pair<int, int>
#define pow2(g2) (1ll << (g2))
#define II inline void
#define INF (0x3f3f3f3f)
#define ps push
#define lsond lson, l, mid
#define rsond rson, mid + 1, r

namespace Fread
{
    const int SIZE = (1 << 26) + 1; // namespace Fread
    char buf[SIZE], *S, *T;
}
namespace Fwrite
{
    const int SIZE = (1 << 26) + 1; // namespace Fwrite
    char buf[SIZE], *S = buf, *T = buf + SIZE;
    inline void flush()
    {
        fwrite(buf, 1, S - buf, stdout), S = buf;
    }
    struct NTR
    {
        ~NTR()
        {
            flush();
        }
    } ztr;
}

#ifdef ONLINE_JUDGE
#define getchar() (Fread::S == Fread::T && (Fread::T = (Fread::S = Fread::buf) + fread(Fread::buf, 1, 1 << 23, stdin), Fread::S == Fread::T) ? '\n' : *Fread::S++)
#define putchar(c) (*Fwrite::S++ = c, (Fwrite::S != Fwrite::T) ? 0 : (Fwrite::flush(), 0))
#endif
namespace Fastio
{
    struct Reader
    {
        template <typename T>
        inline Reader &operator>>(T &now)
        {
            static char c;
            static short f;
            c = getchar(), f = 1;

            while (!isdigit(c))
            {
                c ^ '-' ? c = getchar() : (f = -1, c = getchar());
            }
            now = 0;

            while (isdigit(c))
            {
                now = now * 10 + (c ^ '0'), c = getchar();
            }
            return now *= f, *this;
        }
        inline Reader &operator>>(char &c)
        {
            c = getchar();

            while (c == '\n' || c == ' ')
                c = getchar();

            return *this;
        }
        inline Reader &operator>>(char *str)
        {
            static int len = 0;
            len = 0;
            static char c;
            c = getchar();

            while (c == '\n' || c == ' ')
                c = getchar();

            while (c ^ '\n' && c ^ ' ')
            {
                str[len++] = c, c = getchar();
            }
            return str[len] = '\0', *this;
        }
        Reader() {}

    } cin;
    const char endl = '\n';
    struct Writer
    {
        template <typename T>
        inline Writer &operator<<(T now)
        {
            static int cnt = 0;
            now ? (now < 0 ? putchar('-'), now = -now, cnt = 0 : cnt = 0) : (putchar('0'), cnt = 0);
            static int sta[45];

            while (now)
            {
                sta[++cnt] = now % 10, now /= 10;
            }
            while (cnt)
            {
                putchar(sta[cnt] | 48), --cnt;
            }
            return *this;
        }
        inline Writer &operator<<(const char c)
        {
            return putchar(c), *this;
        }
        inline Writer &operator<<(const char *str)
        {
            static int cur = 0;
            cur = 0;

            while (str[cur])
                putchar(str[cur++]);

            return *this;
        }
        inline Writer &operator<<(char *str)
        {
            static int cur = 0;
            cur = 0;

            while (str[cur])
                putchar(str[cur++]);

            return *this;
        }
        Writer() {}

    } cout;
}

#define cin Fastio ::cin
#define cout Fastio ::cout
#define endl Fastio ::endl

using namespace std;
namespace Mystd {
const int mode=998244353;
inline unsigned highbit(const unsigned now) {return (1u<<(31-__builtin_clz(now)));}
inline long long qpow(ll a,ll b){ll ans=1;for (;b;b>>=1){ if (b&1) ans=ans*a;a=a*a;}return ans;}
inline long long modqpow(ll a,ll b,const int mode1 = mode){ll ans=1;for (;b;b>>=1){if (b&1) ans=ans*a%mode1;a=a*a%mode1;}return ans;}
template<typename _Tp>inline _Tp Max(const _Tp g1, const _Tp g2) {return g1 < g2 ? g2 : g1;}
template<typename _Tp, typename ...Args>inline _Tp Max(const _Tp g1, const _Tp g2, const Args... others) {return Max(Max(g1, g2), others...);}
template<typename _Tp>inline _Tp Min(const _Tp g1, const _Tp g2) {return g1 < g2 ? g1 : g2;}
template<typename _Tp, typename ...Args>inline _Tp Min(const _Tp g1, const _Tp g2, const Args... others) {return Min(Min(g1, g2), others...);}
inline void add(int &a,const int b) {((a+=b)>=mode) && (a-=mode);}
inline void sub(int &a,const int b) {((a-=b)<0) && (a+=mode);}
inline constexpr int add1(const int a,const int b) {return (a+b>=mode ? a+b-mode : a+b);}
inline constexpr int sub1(const int a,const int b) {return (a-b<0 ? a-b+mode : a-b);}
inline constexpr int  mul(int a,int b)  {return 1ll*a*b%mode;}
int fac[MAXN + 5],ifac[MAXN + 5];
inline void init(int lim = MAXN){fac[0] = 1;fo (i,1,lim) fac[i]=mul(fac[i-1],i);ifac[lim] = modqpow(fac[lim],mode-2);fd (i,lim-1,0) ifac[i]=mul(ifac[i+1],i+1);}
inline int comb(int n,int k){if (n<k) return 0;return mul(fac[n],mul(ifac[k],ifac[n-k]));}
}
using namespace Mystd;
}
using namespace trash_with_mode;
int n,m;
int a[MAXN];
bitset<MAXN> b[MAXN];
signed main()
{
#ifndef ONLINE_JUDGE
    freopen("txt.in", "r", stdin);
    freopen("txt.out", "w", stdout);
#endif
    cin >> n >> m;
    fo (i,1,m)
    {
        int k;cin >> k;
        fo (j,1,k)
        {
            int a;
            cin >> a;
            b[i][a] = 1;
        }
    }
    fo (i,1,n)
    {
        fo (j,1,n)
        {
            if (i==j) continue;
            int flag = 0;
            fo (k,1,m)
            {
                if (b[k][i] && b[k][j]) flag=1;
            }
            if (!flag)
            {
                cout<<"No"<<endl;return 0;
            }
        }
    }
    cout<<"Yes\n";
    return 0;
}

Submission Info

Submission Time
Task B - Everyone is Friends
User lby_my_superman
Language C++ (GCC 9.2.1)
Score 200
Code Size 6265 Byte
Status AC
Exec Time 7 ms
Memory 3640 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 2
AC × 21
Set Name Test Cases
Sample 00_sample_01.txt, 00_sample_02.txt
All 00_sample_01.txt, 00_sample_02.txt, 01_test_01.txt, 01_test_02.txt, 01_test_03.txt, 01_test_04.txt, 01_test_05.txt, 01_test_06.txt, 01_test_07.txt, 01_test_08.txt, 01_test_09.txt, 01_test_10.txt, 01_test_11.txt, 01_test_12.txt, 01_test_13.txt, 01_test_14.txt, 01_test_15.txt, 01_test_16.txt, 01_test_17.txt, 01_test_18.txt, 02_handmade_01.txt
Case Name Status Exec Time Memory
00_sample_01.txt AC 7 ms 3432 KiB
00_sample_02.txt AC 2 ms 3384 KiB
01_test_01.txt AC 2 ms 3352 KiB
01_test_02.txt AC 3 ms 3348 KiB
01_test_03.txt AC 2 ms 3488 KiB
01_test_04.txt AC 6 ms 3504 KiB
01_test_05.txt AC 3 ms 3504 KiB
01_test_06.txt AC 4 ms 3584 KiB
01_test_07.txt AC 2 ms 3392 KiB
01_test_08.txt AC 2 ms 3528 KiB
01_test_09.txt AC 2 ms 3404 KiB
01_test_10.txt AC 2 ms 3404 KiB
01_test_11.txt AC 3 ms 3572 KiB
01_test_12.txt AC 2 ms 3576 KiB
01_test_13.txt AC 2 ms 3320 KiB
01_test_14.txt AC 2 ms 3492 KiB
01_test_15.txt AC 2 ms 3576 KiB
01_test_16.txt AC 3 ms 3572 KiB
01_test_17.txt AC 2 ms 3640 KiB
01_test_18.txt AC 3 ms 3480 KiB
02_handmade_01.txt AC 3 ms 3400 KiB