코딩
백준 1092. 배 파이썬(PYTHON)
무는빼주세요
2020. 11. 14. 14:28
문제링크 : www.acmicpc.net/problem/1092
1092번: 배
첫째 줄에 N이 주어진다. N은 50보다 작거나 같은 자연수이다. 둘째 줄에는 각 크레인의 무게 제한이 주어진다. 이 값은 1,000,000보다 작거나 같다. 셋째 줄에는 박스의 수 M이 주어진다. M은 10,000보
www.acmicpc.net
#PYPY3로 실행
N = int(input())
cre = sorted(list(map(int,input().split())), reverse=True)
M = int(input())
boxs = sorted(list(map(int,input().split())), reverse=True)
if cre[0] < boxs[0]:
print(-1)
else:
count=0
while boxs:
count+=1
for i in cre:
if not boxs:
break
else:
for j in range(len(boxs)):
if boxs[j] <= i:
boxs.pop(j)
break
print(count)