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())
print(parking)
print(queue)
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)
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
13 ms |
2824 KB |
Output isn't correct |
2 |
Incorrect |
14 ms |
2900 KB |
Output isn't correct |
3 |
Incorrect |
13 ms |
2864 KB |
Output isn't correct |
4 |
Incorrect |
14 ms |
2932 KB |
Output isn't correct |
5 |
Incorrect |
13 ms |
2900 KB |
Output isn't correct |
6 |
Incorrect |
14 ms |
2928 KB |
Output isn't correct |
7 |
Incorrect |
17 ms |
2892 KB |
Output isn't correct |
8 |
Incorrect |
18 ms |
2992 KB |
Output isn't correct |
9 |
Incorrect |
16 ms |
2848 KB |
Output isn't correct |
10 |
Incorrect |
33 ms |
3456 KB |
Output isn't correct |
11 |
Incorrect |
38 ms |
3892 KB |
Output isn't correct |
12 |
Incorrect |
60 ms |
4712 KB |
Output isn't correct |
13 |
Incorrect |
67 ms |
5448 KB |
Output isn't correct |
14 |
Incorrect |
163 ms |
9392 KB |
Output isn't correct |
15 |
Incorrect |
244 ms |
12984 KB |
Output isn't correct |
16 |
Incorrect |
355 ms |
19748 KB |
Output isn't correct |
17 |
Incorrect |
477 ms |
25144 KB |
Output isn't correct |
18 |
Runtime error |
724 ms |
34020 KB |
Memory limit exceeded |
19 |
Runtime error |
757 ms |
42200 KB |
Memory limit exceeded |
20 |
Runtime error |
874 ms |
41288 KB |
Memory limit exceeded |