You may already know that how the World Finals slots are distributed in EC sub-region. But you still need to keep reading the problem in case some rules are different.
There are totally G slots for EC sub-region. X slots will be distributed among five China regional sites and Y slots will be distributed to the EC-Final. Of course X and Y are non-negative integers and X + Y = G.
Here is how the X slots be distributed:
1. Slots are assigned to the Asia Regional sites from the first place, the second place, · · · , last place.
2. For schools having the same place across the sites, the slots will be given in the order of the number of “effective
teams” in the sites.
3. No school could be assigned a slot 2 times, which means the schools will be skipped if they already got a slot.
After X slots are distributed, the EC-Final ranklist from highest rank will be assigned Y slots for those schools that haven’t got a slot yet.
Now here comes a sad story, as X and Y are not announced until the end of the last regional contest of that year, even later!!!
Teachers from a school are worried about the whether they can advance to WF whatever the X and Y is. Let’s help them find out the results before the announcement of X and Y .