spisak
Election Commission of Bajtograd municipality got a letter from Republic Election Commission about the new ordering of voters, by which the voters get the number which determines their position in the voters list based on their position in the lexicographically sorted voters list for the whole municipality. Unfortunately, this letter arrived only a week before the elections, after they had already sent the voting invitations with numbers based on the old voters list which was not sorted, but the voters were added and removed as they attained or lost their voting right. To save up, the members of commission came up with an idea that they don’t have to send new invitations to everyone, but only to those voters whose numbers differ in the old and the new voters list. Help them count how many invitations they have to send.
Limitations:
• Number of voters is smaller than 1000,
• The length of first and last name is shorter than 25 characters,
• Time limit is 1 s.
4
ana popovic
nikola peric
nemanja tomic
marko djordjevicOutput:
29
ana popovic
nemanja tomic
marko djordjevic
nikola peric
marko djordjevic
ana popovic
nikola peric
sanja popovic
marko djordjevicOutput:
5Clarification for example 2:
Voters that don’t need a new invitation are: ana popovic (number 1), marko djordjevic (number 3), marko djordjevic (number 5) and nikola peric (number 7). Notice that this new list after the lexicographical sort looks like this: ana popovic, ana popovic, marko djordjevic, marko dordjevic, marko djordjevic, nemanja tomic, nikola peric, nikola peric, sanja popovic.
Submit solution
Coming laterThe grading service will be connected in a later migration step. You can inspect the task and your previous results now.