Problem Link : https://www.codechef.com/problems/CHEFRECP
My Solution : https://ide.codingblocks.com/s/242221
Problem Link : https://www.codechef.com/problems/CHEFRECP
My Solution : https://ide.codingblocks.com/s/242221
hey, I will just try and solve it and give you the correct answer, this reply is just to assure you that your doubt has been acknowledged
hey, i just submitted this soln and it got correct answer
logic:
i start checking for continuous repeats of a number and store their count in a map
if a find a number which was already in the map, i will return false, since one number can only occur in a continuous fashion
then i check for the counts, all the counts should be unique, if a count comes again then i returned no
Actually, my Logic was also the same.
Firstly, I checked, if the count of each integer is different or not. I did this with the help of the map.
In the second statement, I checked, if each integer is in continuous form or not.

For the satisfaction of the first statement, I use a map to store the v[i] as a key and count as the value.
The counts are stored in a vector. The vector is sorted.
After this, I have checked, if the count is unique or not.

For the satisfaction of the 2nd statement, I cleared the previous map.
And I put the value of the m[v[i]]++, whenever the v[i] != v[i+1]
And I output “NO”, whenever, the m[v[i]]>0 (because, if this statement is there, then, this means, v[i] was there previous)
But, the problem is, I am getting the wrong answer. I am not able to figure out, where I am wrong.
only checking the count is no enough, checking count continuously is the key
because see
1 1 7 7 3 7 is also wrong even though the count is diff
because 7 once used cannot be used again
Yeah, Therefore I have also satisfied 2nd statement.
I have tried to satisfy both of the statement. But, the problem is, that I’am still getting wrong answer on CodeChef.
The point which makes my code different from others is the use of map.
I’ve used map for both counts and also for checking continuous.
I am not able to find out the bug or error in my code.
please help me find out the error in my code.
see, u need to do it in order, u are storing counts first
change the order of checking, first check for only appearance is continouos
and then check for counts
because if counts are checked first the appearance order has been disturbed
Yeah, you are right.
Now, it is passing all the test cases.
But, I’ve one confusion in my mind that, I am using a separate vector ‘v_count’ for storing counts.
And I am using ‘v’ vector only in the 2nd statement.
So, how the appearance order has been disturbed?
Please help me to find out the bug
not disturb the order
it would as in, order won’t matter
since only counts matter now in ur code
Can you please explain again, I am not able to understand.