The problem states that since 1 voted for himself, he cannot be part of student council and hence the size should be 0. Implement this and check if it helps!
Also, be careful that the number of votes should be ATLEAST K as in >=K.
You have to correct the cases when person votes for himself.you can correct this by keeping track of people who voted for themselves and making count of those equal to zero and then checking that >=k condition this will get you an AC.
hey it happened to me just now…when I submitted code it showed me compilation error without any reason,and then after sometime it showed me WA on submitting same solution…
c is a hash function you just need to check for 1 t0 100 in 2nd loop.and count all the students who have at least k votes. i want to put simple example like this take
1
5 3
100 100 100 90 90. this will give ans 1 but your program will give ans 0. so you have to make 2nd loop from 1 to 100. definitely it will help for you.
I just tried by putting an extra condition…but it didn’t work.
but thanks I have seen solution of another user…everything same except 1-based array indexing,where I used 0-based.