Submission #549920

#TimeUsernameProblemLanguageResultExecution timeMemory
549920DeathIsAweGarage (IOI09_garage)Cpython 3
100 / 100
36 ms3324 KiB
weights={} rates={} n,m=[int(i) for i in input().split()] freepark=[i+1 for i in range(n)] queue=[] money=0 parking={} for i in range(n): rates[i+1]=int(input()) for i in range(m): weights[i+1]=int(input()) for i in range(2*m): car=int(input()) if car>0: queue.append(car) while len(freepark)>0 and len(queue)>0: parking[queue[0]]=min(freepark) money+=rates[min(freepark)]*weights[queue[0]] freepark.remove(min(freepark)) del queue[0] if car<0: freepark.append(parking[-car]) while len(freepark)>0 and len(queue)>0: parking[queue[0]]=min(freepark) money+=rates[min(freepark)]*weights[queue[0]] freepark.remove(min(freepark)) del queue[0] print(money)
#Verdict Execution timeMemoryGrader output
Fetching results...