|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|2 초||512 MB||0||0||0||0.000%|
N students are sitting in a row, taking an exam. They are numbered from left to right with integers starting from 1. It is known how good each student’s work is: i-th student is going to score exactly Ai points.
Sometimes the proctor leaves for a break and when that happens students can cheat: any two or more consecutive students can gather and copy the best work among them. As a result, their scores become equal to the maximum score in that interval. Cheating can happen arbitrarily many (possibly zero) times.
In order to pass the exam i-th student needs to score exactly Bi points. Determine the maximum number of students that can pass the exam.
In the first line of the input there is an integer N.
In the next line there are N integers: A1, A2, ..., AN.
In the next line there are N integers: B1, B2, …, BN.
You should print exactly one integer: the maximum number of students.
3 1 2 3 2 2 2
4 10 1 9 1 10 9 10 9
In the first example the first two students can cheat after which the scores becomes 2,2,3 and they both pass the exam.
In the second example students 2 and 3 can pass the exam but not both at the same time. Note that this test can’t be present in subtasks 2,3 or 4.