# October Long Challenge 2019 Div 2: Maximum Star Value (MSV)

I wrote the following solution to solve the problem during the contest, but I am getting TLE in 2 cases.
Source-Code: https://www.codechef.com/viewsolution/27340367

The algorithm which I designed is basically based on this article https://www.geeksforgeeks.org/queries-counts-multiples-array/ on GeekforGeeks but rather than updating the `freq_data[]` at once I will first check how many multiples of the `arr[i]` is present in the `freq_data[]` and after finding all the multiples, I will keep track of maximum multiples for a number I found out till now.

Then when I traversed the whole array, I will print the value stored in the variable `max_star_val` and that will be the answer.

Bruh how did you pass last two but not 2nd and 3rd?!
Look at this

I think majority people got AC in first three.

@rude009 Well I guess my logic was good for the last two cases, I have been trying different ideas for passing the 2 other cases, none of them worked out.

Can you elaborate on what ideas you used in order to solve the problem?

2 Likes

I did this:

1. Traversed from the end and stopped when pointer was less or equal to max count.
2. Skipped 1’s.
3. Skipped repeated elements.

@rude009 So…let’s wait for the editorial for the problem, in the mean time, if I get any ideas, will post here, thanks for sharing the approach

1 Like