Блог пользователя AtomRush

Автор AtomRush, 9 лет назад, По-английски

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

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

»
9 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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

»
9 лет назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

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.