Problem list
Log in
#r03118 · Online Judge > GoldOJ

Edible Pairs

Silver III 2.0 s 1024 MB

Species A can eat a species-B creature only if it is strictly larger. Given the sizes of $N$ A-creatures and $M$ B-creatures, count the pairs $(a, b)$ with $a > b$.

Input

Line 1: $N$ $M$. Line 2: $N$ sizes of A. Line 3: $M$ sizes of B.

Output

Print the number of edible pairs.

Example 1

Input
5 3
8 1 7 3 1
3 6 1
Output
7

Example 2

Input
3 4
2 13 7
103 11 290 215
Output
1
Source
Online Judge > GoldOJ
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