#P3429. [POI 2005] DWA-Two Parties
[POI 2005] DWA-Two Parties
Description
The Byzantine king is going to host two large parties and hopes to invite more residents.
From his rich experience, the king knows that if a resident meets an even number of friends at the party, they will be very happy. Therefore, he asks you to assign the country's residents to two parties so that as many people as possible have an even number of friends at the party they attend.
Acquaintance is a symmetric relation: if knows , then also knows .
Input Format
There are lines in total.
The first line contains an integer (), the number of residents.
In the next lines, the -th line contains an integer , the number of friends of the -th resident, followed by integers, which are the indices of the -th resident’s friends. We assume no one is their own friend. If appears in ’s friend list, then also appears in ’s list.
Output Format
The first line contains an integer , the number of people attending the first party. The second line contains integers, which are the indices of the residents going to the first party; the remaining residents go to the second party.
If there are multiple valid answers, output any one of them.
5
3 2 3 4
2 1 3
4 2 1 4 5
2 1 3
1 3
3
1 2 3
Hint
Translated by ChatGPT 5
京公网安备 11011102002149号