Language: C++

#include <bits/stdc++.h>

using namespace std;

int64_t point[100000*100000+10][2];
int64_t node;
int64_t a[100000*2+10];
bool visit[100000*2+10];
int64_t s[100000*2+10];
int64_t h,t;

int main()
{
    memset(point,0,sizeof(point));
    memset(a,0,sizeof(a));
    node=0;
    int64_t n,m;
    cin>>n>>m;
    for (int64_t i=1;i<=n;i++)
    {
     int temp;
     cin>>temp;
     for (int64_t j=1;j<=temp;j++)
     {
      int64_t k;
      cin>>k;
      node++;
      int64_t pp=a[i];
      node++;
      point[node][0]=k+100001;
      point[node][1]=pp;
      a[i]=node;
      node++;
      pp=a[k+100001];
      point[node][0]=i;
      point[node][1]=pp;
      a[k+100001]=node;
      //int qq=a[i+100001];
     }

    }
     memset(visit,true,sizeof(visit));
     h=0;t=1;
     s[1]=1;

     while (h!=t)
     {
      h++;
      int64_t pp=a[s[h]];
      while (pp)
      {
       if (visit[point[pp][0]])
       {
        visit[point[pp][0]]=false;
        t++;
        s[t]=point[pp][0];
       }
       pp=point[pp][1];
      }
     }
     bool flag=false;
     for (int64_t i=1;i<=n;i++)
     {
      if (visit[i])
      {
       flag=true;
       break;
      }
     }
     if (flag) cout<<"NO"<<endl;
     else cout<<"YES"<<endl;
    return 0;
}


Compiler output:
a.cc:5:21: warning: integer overflow in expression of type 'int' results in '1410065408' [-Woverflow]
    5 | int64_t point[100000*100000+10][2];
      |               ~~~~~~^~~~~~~
a.cc:5:28: error: size of array 'point' exceeds maximum object size '9223372036854775807'
    5 | int64_t point[100000*100000+10][2];
      |               ~~~~~~~~~~~~~^~~
a.cc: In function 'int main()':
a.cc:42:13: error: reference to 'visit' is ambiguous
   42 |      memset(visit,true,sizeof(visit));
      |             ^~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:80,
                 from a.cc:1:
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:8:6: note:                 'bool visit [200010]'
    8 | bool visit[100000*2+10];
      |      ^~~~~
a.cc:42:31: error: reference to 'visit' is ambiguous
   42 |      memset(visit,true,sizeof(visit));
      |                               ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:8:6: note:                 'bool visit [200010]'
    8 | bool visit[100000*2+10];
      |      ^~~~~
a.cc:52:12: error: reference to 'visit' is ambiguous
   52 |        if (visit[point[pp][0]])
      |            ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:8:6: note:                 'bool visit [200010]'
    8 | bool visit[100000*2+10];
      |      ^~~~~
a.cc:54:9: error: reference to 'visit' is ambiguous
   54 |         visit[point[pp][0]]=false;
      |         ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:8:6: note:                 'bool visit [200010]'
    8 | bool visit[100000*2+10];
      |      ^~~~~
a.cc:64:11: error: reference to 'visit' is ambiguous
   64 |       if (visit[i])
      |           ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:8:6: note:                 'bool visit [200010]'
    8 | bool visit[100000*2+10];
      |      ^~~~~