Editorial for TLE '17 Contest 2 P2 - Unlucky Numbers
                Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.
                Submitting an official solution before solving the problem yourself is a bannable offence.
Author:
The solution uses a prefix sum array. Create an int array  of size 
, and ensure that all values in that array are set to 0. Then, for each unlucky number 
, set 
 to 
.
Now you may create a prefix sum array with the same size as  (
). In the PSA, 
, and for all 
, 
. The PSA shows you that for an apartment with top floor 
, there will be 
 floors removed.
Time Complexity: 
Comments