Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- constexpr int maxn=101;
- int comp(int a[maxn][maxn], int n,int A[],int k)
- {
- for(int i=1;i<=n-1;i++)
- {
- for(int j=i+1;j<=n;j++)
- {
- if(A[i]==A[j] && a[i][j]==1)
- {
- /// cout<<i<<" "<<j;
- return 0;
- }
- }
- }
- return 1;
- }
- int main()
- {
- ifstream f("bipartit.in");
- ofstream g("bipartit.out");
- int A[maxn]={},n,m,a[maxn][maxn]={},x,y,k;
- f>>n>>m;
- for(int i=1;i<=m;i++)
- {
- f>>x>>y;
- if(x<maxn && y<maxn)
- a[x][y]=a[y][x]=1;
- }
- f>>k;
- for(int i=1;i<=k;i++)
- {
- f>>x;
- A[x]=1;
- }
- int verif;
- /// verif=bipartit(a,n,A,k);
- verif=comp(a,n,A,k);
- /* for(int i=1;i<=n;i++)
- {
- if(d(a,n,i)==0)
- verif=0;
- }
- */
- if(verif==1) g<<"DA";
- else
- g<<"NU";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement