AtomRush's blog

By AtomRush, 9 years ago, In English

Question : RRFRNDS I used brute force to solve this and was expecting a TLE but got a WA instead Somebody provide me some hints to solve this

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

»
9 years ago, # |
  Vote: I like it 0 Vote: I do not like it

You can find editorial at codechef. Editorial link has to be under the statement as i remember.

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

Let's call list[i] is all friend of user[i], after that, we check all pair (i, j), if currently i and j is not friend and exists an user in list[i] is also friend of j, then pair (i, j) is valid, we increase the answer to 1.