Interesting Pairs

Правка en2, от DijkstraAlgorithm, 2022-12-04 07:35:17
Interesting Pairs

                                      time limit : 2 sec
                                      Memory limit : 256 MegaBytes

A pair ( x , y ) is called an interesting pair if it holds the following condition :- 1. x < y. 2. x is even , y is odd.

Given an array of n integers , you have to count the total no of interesting pairs.

Input format : the first line of input contains T (T<1000) the no of test cases , next two lines of each test case will contain description of each test case ,length of array n and the elements of array a1,a2,a3,.....,an (ai<10^5) .

It is guarranted that sum of n over all test cases doesn't exceed 2 * 10^5.

Output Format : the only line of output for each test case contains the total of interesting pairs.

Input : 2 10 1 2 3 4 5 6 7 8 9 10 4 2 4 10 12

Output : 10 0

Input : 1 6 4 11 5 6 9 3

Output : 8

Теги greedy, data structures, sorting, implementations

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский DijkstraAlgorithm 2022-12-04 07:35:17 28 Tiny change: ' of array .\n\nIt i' -> ' of array a1,a2,a3,.....,an (ai<10^5) .\n\nIt i' (published)
en1 Английский DijkstraAlgorithm 2022-12-04 07:10:08 941 Initial revision (saved to drafts)