Unable to solve Gadget Fan (February 17 Easy — hackerearth)

Правка en1, от Bob_and_Vagene, 2017-02-06 18:28:50

link to the problem : https://www.hackerearth.com/practice/math/combinatorics/inclusion-exclusion/practice-problems/algorithm/gadget-fan/description/

I am only able to get 68 points when i submitted an O(n) solution. I am not able to optimize it further. I read the editorial as well but i wasn't able to understand it. So, if anyone could explain me the editorial or provide an alternate efficient approach to this problem.

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский Bob_and_Vagene 2017-02-06 18:28:50 490 Initial revision (published)