IPSC Logo

Internet Problem Solving Contest

IPSC 2001

Solution to Problem G – Gossipers

Since this problem is rather easy a straightforward solution is good enough. So we will just simulate the meetings as they was happening. For each gossip we will traverse through the meetings and count the number of all gossipers that got to know this gossip.

To make the solution a bit faster, we can put gossipers' names into a hash table. That makes us able to put a name into the table and also to find a certain name in the table in O(L) time, where L is length of the name.