Thank you too! It works fine now! c(^-^)c

On Friday, 17 April 2020 01:58:27 UTC+2, mattf...@gmail.com wrote:
>
> You are correct in sorting the dates, but you must print the assignments 
> in the same order in which the dates were entered, not in the sorted order.
>
> Also, your english looks good to me :)
>
> On Apr 16, 2020, at 6:40 PM, Tornax <torn...@gmail.com <javascript:>> 
> wrote:
>
> 
> Hello, I'm trying to solve the 3. task of the qualification round 2020.
> I'm using Python3 to solve this problem.
> When I'm submiting my code it says "Sample Failed: WA".
> This is my code:
>
> number_of_cases = int(input())
>
> for case_number in range(1, number_of_cases + 1):
>
>     appointments = int(input())
>     dates = []
>     solution = ""
>     J_works_till, C_works_till = 0, 0
>     possible = True
>
>     # collect the time
>     for appointment in range(appointments):
>         dates.append(list(map(int, input().split(" "))))
>
>     # Sort the dates
>     dates = sorted(dates, key=lambda x: x[0])
>     
>     for date in dates:
>
>         # Can Jamie handle the task?
>         if J_works_till <= date[0]:
>             J_works_till = date[1]
>             solution += "J"            
>
>         # Can Cameron handle the task?
>         elif C_works_till <= date[0]:
>             C_works_till = date[1]
>             solution += "C"            
>
>         # Nope
>         else:
>             possible = False
>             break
>
>     if possible:
>         print("Case #%d: %s" % (case_number, solution))
>
>     else:
>         print("Case #%d: IMPOSSIBLE" % case_number)
>
>
> I tried the examples of the task and I'm getting the following output:
>
> Case #1: JCJ
> Case #2: IMPOSSIBLE
> Case #3: JCCJC
> Case #4: JJ
>
>
> As you can see, my third solution is a little bit different than in the 
> examples (there's "JCCJJ"). I tried to compare it with the times but it 
> seems to be fine (or I was just stupid).
> If not, do you have an idea what I'm doing wrong?
>
> Sorry for my bad english... I hope that you can still understand me ;-;
>
> Cheers!
>
> -- 
> 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 googl...@googlegroups.com <javascript:>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/google-code/39bddc1a-b32e-4336-8c95-eb80498b40b1%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/google-code/39bddc1a-b32e-4336-8c95-eb80498b40b1%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
>

-- 
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 google-code+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/e65548d9-a491-4763-8886-10ad62aa86e3%40googlegroups.com.

Reply via email to