Ledger Nano X - The secure hardware wallet
SHARE
TWEET

parenting_cj2020_notworking

woonie Apr 4th, 2020 199 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def check_clash(person_schedule,activity_num,activities):
  2.     for person_activity in person_schedule:
  3.         print(str(person_activity) + ", " + str(activity_num))
  4.         if check_activity_clash(activities[person_activity],activities[activity_num]):
  5.             print ("Events " + str(person_activity) + " and " + str(activity_num) + " clashes.")
  6.             return True
  7.         print ("Events " + str(person_activity) + " and " + str(activity_num) + " does not clash.")
  8.     print("Event " + str(activity_num) + " added to activity list " + str(person_schedule))
  9.     return False
  10.    
  11. def check_activity_clash(activity,activity2):
  12.     return activity[1] > activity2[0] and activity2[1] > activity[0]
  13.    
  14. test_cases = int(input())
  15. for test_case in range(test_cases):
  16.     num_activities = int(input())
  17.     impossible = False
  18.     activities = []
  19.     c = []
  20.     j = []
  21.     for a in range(num_activities):
  22.         temp_line = input().split()
  23.         int_temp_line = list(map(int,temp_line))
  24.         activities.append(int_temp_line)
  25.     for i in range(num_activities):
  26.         if check_clash(j,i,activities):
  27.             if check_clash(c,i,activities):
  28.                 impossible = True
  29.                 break
  30.             else:
  31.                 c.append(i)
  32.         else:
  33.             j.append(i)
  34.     if impossible:
  35.         print("C: " + str(c))
  36.         print("J: " + str(j))
  37.         print("Case #"+str(test_case+1)+": IMPOSSIBLE")
  38.     else:
  39.         output = ""
  40.         for k in range(num_activities):
  41.             if k in c:
  42.                 output = output + "C"
  43.             elif k in j:
  44.                 output = output + "J"
  45.         print("Case #"+str(test_case+1)+": " + str(output))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top