Logo
(追記) (追記ここまで)

15282번 - Frosh Week 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
4 초 512 MB1401159282.883%

문제

Professor Zac is trying to finish a collection of tasks during the first week at the start of the term. He knows precisely how long each task will take, down to the millisecond. Unfortunately, it is also Frosh Week. Zac’s office window has a clear view of the stage where loud music is played. He cannot focus on any task when music is blaring.

The event organizers are also very precise. They supply Zac with intervals of time when music will not be playing. These intervals are specified by their start and end times down to the millisecond.

Each task that Zac completes must be completed in one quiet interval. He cannot pause working on a task when music plays (he loses his train of thought). Interstingly, the lengths of the tasks and quiet intervals are such that it is impossible to finish more than one task per quiet interval!

Given a list of times ti (in milliseconds) that each task will take and a list of times lj (in milliseconds) specifying the lengths of the intervals when no music is being played, what is the maximum number of tasks that Zac can complete?

입력

The first line of input contains a pair of integers n and m, where n is the number of tasks and m is the number of time intervals when no music is played. The second line consists of a list of integers t1, t2, . . . , tn indicating the length of time of each task. The final line consists of a list of times l1, l2, . . . , lm indicating the length of time of each quiet interval when Zac is at work this week.

You may assume that 1 ≤ n, m ≤ 200, 000 and 100, 000 ≤ ti, lj ≤ 199, 999 for each task i and each quiet interval j.

출력

Output consists of a single line containing a single integer indicating the number of tasks that Zac can accomplish from his list during this first week.

제한

예제 입력 1

5 4
150000 100000 160000 100000 180000
190000 170000 140000 160000

예제 출력 1

4

예제 입력 2

4 4
180000 185000 199999 100000
199999 180000 170000 120000

예제 출력 2

3

예제 입력 3

3 3
199999 180000 170001
199999 170000 180000

예제 출력 3

2

힌트

출처

ICPC > Regionals > North America > Rocky Mountain Regional > 2017 Rocky Mountain Regional Contest K번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /