Hdu1068 Girls and Boys, hdu1068girls

Source: Internet
Author: User

Hdu1068 Girls and Boys, hdu1068girls

There is a collection male and a collection female, which gives a one-to-one correspondence between the two sets, and asks the number of points in the Maximum Independent Set of the two sets.

Maximum Independent Set = Total number of vertices-Maximum number of matching

In this question, if (a, B) is related, (B, a) is related, and every relationship is calculated twice, which is equivalent to the number of men and women on both sides of the Bipartite Graph,

Therefore, the answer to this question should be the total number of vertices-Maximum number of matches/2


#include<cstdio>#include<cstring>#include<cmath>#include<iostream>#include<algorithm>#include<vector>#include<queue>const int maxn=510;using namespace std;int mx[maxn],my[maxn],vis[maxn],e[maxn][maxn],n;int path(int i){    int j;    for(j=0;j<n;j++)    {        if(e[i][j]&&!vis[j])        {            vis[j]=1;            if(my[j]==-1||path(my[j]))            {                my[j]=i;                mx[i]=j;                return 1;            }        }    }    return 0;}int hungry(){    int res=0;    memset(mx,-1,sizeof mx);    memset(my,-1,sizeof my);    for(int i=0;i<n;i++)    {        if(mx[i]==-1)        {            memset(vis,0,sizeof vis);            res+=path(i);        }    }    return res;}int main(){    int a,b,m,i;    while(~scanf("%d",&n))    {        memset(e,0,sizeof e);        for(i=0;i<n;i++)        {            scanf("%d: (%d)",&a,&m);            while(m--)            {                scanf("%d",&b);                e[a][b]=1;            }        }        printf("%d\n",n-hungry()/2);    }    return 0;}



Boys and Girls lyrics

Song name: Boys and Girls
Artist: Pixie Lott
Album: Young Foolish Happy (Deluxe Edition)

Pixie Lott-Boys And Girls
Im looking in the mirror and I think im liking what I see,
Big, big lights shining bright like in on the TV,
My heart pumps as the bass drum jumps,
You gotta move when the floorboard jumps,
Somethings going on and I think it's going on right now.
All the boys and the girls they 've got it going on,
And when the beat kicks in the feeling in your bones,
When the basement packs and the needle drops,
You can't turn back and you just can't stop.
All the boys and the girls (you know you just can't stop) x2
All the boys and the girls
I can see the silhouettes dancing up against the wall,
It sure feels good, feels good, yeah we're gonna lose control,
Turn it on, make it strong, a good beat never hurt noone,
Kicking up the dust and we're re making every move me know, yeah
All the boys and the girls they 've got it going on,
And when the beat kicks in the feeling in your bones,
When the basement packs and the needle drops,
You can't turn back and you just can't stop.
All the boys and the girls (you know you just can't stop) x4
Wooh Oh, baby don't stop,
Wooh Oh, keep the vibe hot,
Wooh Oh, baby don't stop,
Wooh Oh, keep the vibe hot.
Turn it on, make it strong, a good beat never hurt noone, yeah.
All the boys and the girls they 've got it going on,
And when the beat kicks in the feeling in your bones,
When the basement packs and the... the remaining full text>

Boys and girls

B all
Both generally refers to two people or two sides.
The focus here is on all the students, so we should use all.

PS. your second question. Select both
In this sentence, boys and girls should be regarded as both sides when two independent groups are involved. often is a keyword here. With it, it means that not all people have walkman and mobile phones. all, especially all specified. Therefore, all cannot be used here.

PS. In fact, these two sentences are not only common sentence patterns in writing, but are also widely used in oral English. It is very clear to choose one sentence and read it once.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.