101875 F — Preference Number

Revision en1, by lllAlonsolll, 2018-10-28 06:26:28

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' but 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.me/gym/101875/problem/F

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

Thanks in advance!

Tags codeforces::gym

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English lllAlonsolll 2018-10-29 07:12:20 5 Tiny change: ' 'hated' but others wi' -> ' 'hated' by others wi'
en1 English lllAlonsolll 2018-10-28 06:26:28 1294 Initial revision (published)