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

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

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
  • Проголосовать: не нравится

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

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

»
11 лет назад, скрыть # |
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.