Canadian Computing Competition: 2022 Stage 1, Senior #5
There are () students in a computer science class, with distinct student IDs ranging from to . There are friendships amongst the students, with the being between students and (, and ). Each pair of students in the class are either friends or socially connected. A pair of students and are socially connected if there exists a set of students such that
Initially, each student either intends to write the CCC (if is Y) or does not intend to write the CCC (if is N). Initially, at least one student intends to write the CCC, and at least one student does not intend to write the CCC.
The CCC has allocated some funds to pay some students to be influencers for the CCC. The CCC will repeatedly choose one student who intends to write the CCC, pay them dollars, and ask them to deliver a seminar to all of their friends, and then all of their friends will intend to write the CCC.
Help the CCC determine the minimum cost required to have all of the students intend to write the CCC.
The first line contains the integer .
The next lines each contain two space-separated integers, and ().
The next line contains characters, , each of which is either Y or N.
The next line contains space-separated integers, .
The following table shows how the available marks are distributed.
| Marks Awarded | Number of Students | Payment | Additional Constraints |
|---|---|---|---|
| 5 marks | and for each | ||
| 7 marks | None | ||
| 3 marks | None |
Output the minimum integer number of dollars required to have all of the students to intend to write the CCC.
The CCC should pay \63244$ students will intend to write the CCC.
One optimal strategy is for the CCC to ask students , , , , , and to deliver seminars, in that order, paying them \1$ each.
No comments yet. Be the first to comment!