64 lines
-1 Removal
63 lines
0 Additions
#include<bits/stdc++.h>
#include<bits/stdc++.h>
using namespace std;
using namespace std;
//#define debug(...) printf( __VA_ARGS__ )
//#define debug(...) printf( __VA_ARGS__ )
#define debug(...) /****nothing****/
#define debug(...) /****nothing****/
#define ll long long
#define ll long long
#define ull unsigned long long
#define ull unsigned long long
#define pb push_back
#define pb push_back
#define mem(arr,val) memset(arr,val,sizeof(arr))
#define mem(arr,val) memset(arr,val,sizeof(arr))
#define mp make_pair
#define mp make_pair
#define pii pair<int,int>
#define pii pair<int,int>
#define F first
#define F first
#define S second
#define S second
#define sz(x) (int)(x).size()
#define sz(x) (int)(x).size()
#define nopos string::npos
#define nopos string::npos
#define fr(i,a,b) for(i=a;i<=b;i++)
#define fr(i,a,b) for(i=a;i<=b;i++)
#define frn(i,a,b) for(i=a;i>=b;i--)
#define frn(i,a,b) for(i=a;i>=b;i--)
set<int> st;
set<int> st;
int n,m,i,j,k;
int n,m,i,j,k;
int main()
int main()
{
{
//freopen("d://i.txt","r",stdin);
//freopen("d://i.txt","r",stdin);
//freopen("d://o.txt","w",stdout);
//freopen("d://o.txt","w",stdout);
cin>>n>>m;
cin>>n>>m;
int fl2=1; // every group is not full of traitor
int fl2=1; // every group is not full of traitor
int cnt=0;
int cnt=0;
while(m--)
while(m--)
{
{
scanf("%d",&k);
scanf("%d",&k);
int fl=0; // assume all are traitor in this group
int fl=0; // assume all are traitor in this group
while(k--)
while(k--)
{
{
scanf("%d",&j);
scanf("%d",&j);
auto it=st.lower_bound(-j);
auto it=st.lower_bound(-j);
if(it!=st.end() && *it==-j)
if(it!=st.end() && *it==-j)
{
{
fl=1;
fl=1;
break;
}
}
st.insert(j);
st.insert(j);
}
}
if(fl==0) // all are traitor in this group
if(fl==0) // all are traitor in this group
{
{
fl2=0; // at least one group is all are traitor
fl2=0; // at least one group is all are traitor
break;
break;
}
}
st.clear();
st.clear();
}
}
printf((fl2==0)?"YES":"NO");
printf((fl2==0)?"YES":"NO");
return 0;
return 0;
}
}
Editor
Clear
Export as PDF