So I revisited the problem after reading the many posts. So solution is below, it is working and tested. For each case: 1. take input 2. sort the input , but keep the original order as well 3. Loop through sorted task and check if the task is not overlapping in C -- assign C at original position, similarly for J. Else: IMPOSSIBLE
-- My solution during qual round: 1. Take input 2. Loop through each task and check if it is conflicting in C (this is a loop), else check if it is conflicting in J(this is also loop), Else : IMPOSSIBLE This gives output which passes SAMPLE CASE#3: 'CJJCC' but we get WA for submittion. Granted the my qual solution is not ideal, hitting O(n^2) but I don't see anywhere in problem stating that when allocating task we need to do an ascending order. Did I miss something in the statement/language ?? Let me know if you need to the code which is working. On Saturday, 11 April 2020 05:42:41 UTC-7, Robert Stacey wrote: > > There was also a runtime error - in your original code you'd break out of > the loop when it became impossible and leave the rest of that test case in > the input buffer. You would then either try to read a line with one integer > and split it into two (RE) or read past the end of the buffer (RE) as your > input wasn't what you expected. > > On Friday, 10 April 2020 19:49:15 UTC+1, eegee wrote: >> >> Turns out that it *was not* a Runtime Error. Thanks to @porker2008 I was >> able to fix my answer by first sorting the activities. Apparently "Case #3: >> CJJCC" is not a valid alternative for "Case #3: JCCJJ". >> >> >> -- You received this message because you are subscribed to the Google Groups "Google Code Jam" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/google-code/b8457d2e-836a-48ad-8128-88e381496199%40googlegroups.com.
