Problem list
Log in
#joi00121 · JOI 2021 Preliminary 1C

比較 (Comparison)

Bronze II 2.0 s 1024 MB

長さ N の整数列 A = (A 1 , A 2 , ..., A N ) と長さ M の整数列 B = (B 1 , B 2 , ..., B M ) が与えられる.

次の条件をすべて満たす 2 つの整数の組 (i,j) の個数を求めよ.

1 ≦ i ≦ N .

1 ≦ j ≦ M .

A i ≦ B j .

Input

入力は以下の形式で標準入力から与えられる.

N M

A 1 A 2 ... A N

B 1 B 2 ... B M

Output

A i ≦ B j を満たす (i,j) の個数を出力せよ.

Constraints

1 ≦ N ≦ 100 .

1 ≦ M ≦ 100 .

1 ≦ A i ≦ 2000 ( 1 ≦ i ≦ N ).

1 ≦ B j ≦ 2000 ( 1 ≦ j ≦ M ).

Example 1

Input
5 4
3 8 10 5 5
1 5 4 9
Output
8

Example 2

Input
3 5
2000 2000 2000
1 1 1 1 1
Output
0

Example 3

Input
1 1
1000
1000
Output
1

Example 4

Input
10 10
3 1 4 1 5 9 2 6 5 3
2 7 1 8 2 8 1 8 2 8
Output
58
Source
JOI 2021 Preliminary 1C
Appears in
Not part of a ladder, contest or set yet.
Accepted 0 Submissions 0 Acceptance 0% Solvers 0

Discussion

Threads about this problem. Spoilers are collapsed; wrap hints in ||double bars||.

No discussion yet. Start a thread if something here needs explaining.

Recent submissions Open with filters
Code