Number of Pairs satisfying the condition

Revision en1, by CopeCope, 2018-05-18 00:57:40

Given N arrays of arbitrary length each, and M queries in form : a b. For each query output the number of arrays such that there exist Array[i] = a Array[j] = b and i < j (Basically, number of arrays such that a comes before b). Also, there can be any number of a's or b's in any array

Example: Arrays
1 2 3 4
2 4
2 3 1 4

and queries are (1, 3) , (2, 4) , (1, 4) , (4, 1) answers are 1 , 3 , 2 , 0

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English CopeCope 2018-05-18 01:16:31 81 Tiny change: ' array\n\nExampl' -> ' array\n\n$N,M,a,b<=10^5$\n\nExampl'
en1 English CopeCope 2018-05-18 00:57:40 529 Initial revision (published)