lllAlonsolll's blog

By lllAlonsolll, history, 6 years ago, In English

Hi guys, I've been trying the Gym labeled as 2018 UCP-ICMC and I am getting stuck with problem F, I cannot even pass the test 7.

To summarize, what I did was to identify what are the integers that all friends who listed what numbers their like, are in common. So, if 5 friends with a set of integers A, B, C, D, E look for the intersection of A, B, C, D & E. Finally, since the rest of friends just mentioned what numbers their hate (assuming what they did not mention are numbers they like), I just remove all integeres that were listed as 'hated' from the intersection of sets I had.

So my final answer ended up being something like |U| — |H|, where U is the set resulting from Union of the intersection of all integers listed as 'liked' and all integers listed as 'hated' and H is the set of hated integers (here all items 'liked' but 'hated' by others will be not taken into account).

Here is the appoach mentioned above: https://ideone.com/FQnNov Here is the latest attempt I did that ended up in same result: https://ideone.com/u9PU7m

This is the problem I am trying to deal with: http://codeforces.com/gym/101875/problem/F

I would appreciate your guidance, help, suggestions, pretty sure it will help me a lot :)

Thanks in advance!

  • Vote: I like it
  • 0
  • Vote: I do not like it

»
6 years ago, # |
Rev. 4   Vote: I like it 0 Vote: I do not like it

It seems that your solution is missing the boundary case when t = 2 for all persons. In such case, the answer should be

1018 -  total_count( disliked numbers ).

Check the last statement in the following submission for more details. 44991896