i am getting wrong ans every time…i ve tested my code on numerous inputs & getting the o/p as desired …can any1 help
In the problem the value of N is quite small(N<=1000) so instead of sorting u can make use of hashing . Make an bool array of 1000, Mark all finished jobs as FALSE and from remaining jobs print alternatively for Chef and his Assistant.
as indicated by @coderfrmhell you should not sort the array…you can use a boolarray for indicating whether job is finished or not.and while printing you can chack whether the job is at odd place or even place and then print according to situation.you can see my code for reference http://www.codechef.com/viewsolution/1503669.
thanks to both of u…
i don’t know what is hashing and how to apply it… and how to use bool…?
Can you tell me what’s the problem with sorting the array?
as i am also using the same logic(i.e. firstly i sorted the array and then i did comparisons and all)
and i am also getting WA.