PivotOJ

Split the Attractions

시간 제한: 2000ms메모리 제한: 1024MB출처: IOI 2019BOJ 19915

문제

There are nn attractions in Baku, numbered from 00 to n1n-1. There are also mm two-way roads, numbered from 00 to m1m-1. Each road connects two different attractions. It is possible to travel between any pair of attractions through the roads.

Fatima is planning to visit all of the attractions in three days. She already decided that she wants to visit aa attractions on the first day, bb attractions on the second day, and cc attractions on the third day. Therefore, she is going to partition the nn attractions into three sets AA, BB, and CC of sizes aa, bb, and cc, respectively. Each attraction will belong to exactly one set, so a+b+c=na + b + c = n.

Fatima would like to find the sets AA, BB, and CC, so that at least two out of the three sets are connected. A set SS of attractions is called connected if it is possible to travel between any pair of attractions in SS by using the roads and without passing through any attraction not in SS. A partition of attractions into sets AA, BB, and CC is called valid if it satisfies the conditions described above.

Help Fatima find a valid partition of the attractions (given aa, bb, and cc), or determine that no valid partition exists. If there are multiple valid partitions, you may find any of them.

코드를 제출하려면 로그인하세요.