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

On Friday, 17 April 2020 01:56:07 UTC+2, /dev/joe wrote:
>
> The input time ranges for case 3 were:
>
> 99 150
> 1 100
> 100 301
> 2 5
> 150 250
>
> JCCJC means to assign 1-100, 100-301, and 150-250 to C, but the last two 
> of those overlap.
>
> While sorting the tasks by starting time in order to determine who can 
> handle each one is a good strategy, you have to also retain the original 
> order because the output is based on that order.
>
>
> On Thu, 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/70bdc821-d570-4c89-a781-cab00e271860%40googlegroups.com.

Reply via email to