Triplets 1

0

0 votes
Easy-Medium
Problem

Given three sorted arrays P, Q, and R of size X, Y and Z respectively. Find total number of triplets (P[i],Q[j],R[k]) such that P[i]<=Q[j]<=R[k] where 1<=i<=X, 1<=j<=Y and 1<=k<=Z.

Input
First line contains integer X. Next line contains X integers separated by space denoting array P.
Next line contains integer Y. Next line contains Y integers separated by space denoting array Q.
Nexy line contains integer Z. Next line contains Z integers separated by space denoting array R.

Constraints
1 <= X, Y, Z <= 105
-109 <= elements of array <= 109

Time Limit: 1
Memory Limit: 256
Source Limit:
Editor Image

?