DCP-422: Double Pairs Back to All Problems

Medium Data Structures > Binary Indexed Tree


You are given an array A of length N. Your task is to find out count of total pairs of indices , say i and j, such that: 1. i<j 2. A[i]*2 <=A[j] Input: ------ Input starts with an integer **T (1<=T<=10)**, denoting the number of test cases. Each case contains an integer **N (1 ≤ N ≤ 100000)** denoting the number of elements of array **A**. The next line will contain **N** integers separated by spaces, denoting the elements of the array **A**. Each of these integers will be non-negative integer not greater than **10^18**. Output: ------- For each case of input, output the total numbers of pairs. Sample Input ------------ 1 3 1 2 5 Sample Output ------------- 3


Problem Setter:

Bishal Gautam

Please login to submit solution to this problem.

Problem Limits

Language Time Limit (seconds)
C 4.00
C++ 4.00
C++14 4.00
C# 6.00
Go 6.00
Java 6.00
JavaScript 6.00
Objective-C 6.00
Perl 6.00
PHP 6.00
Python 6.00
Python3 6.00
Ruby 6.00
VB.Net 6.00

Problem Stats

55/344

Solve/Submission

Ranking

# User Language Timing
01 Jobayer__ Cpp 0.66s
02 feodorv C 0.77s
03 RAKIBUL_HOSSAIN Cpp 1.19s
04 kzvd4729 Cpp14 1.23s
05 Morass Cpp14 1.28s
06 tariqiitju Cpp14 1.30s
07 kisu_pari_na Cpp14 1.38s
08 mahbubcseju Cpp 1.46s
09 SakibAlamin Cpp14 1.49s
10 Limon_88 Cpp14 1.89s
11 shahidul_brur Cpp 2.19s
12 shahed95 Cpp14 2.21s
13 Sarwar05 Cpp14 2.36s
14 _c_k_r_ Cpp 2.40s
15 pulak_ict_mbstu Cpp14 2.45s
16 Masum_ice Cpp 2.73s
17 rohijulislam Cpp 2.81s
18 shahadat191 Cpp 2.90s
19 atiqurrahman Cpp 2.93s
20 anik_JU Cpp 3.10s
21 Reayz Cpp 3.38s
22 ashishgup Cpp 3.39s
23 hrOarr Cpp 3.47s
24 Fazle Cpp14 3.53s
25 ksohan Cpp 3.58s
26 robin_aust Cpp14 3.62s
27 mir003 Cpp 3.67s
28 Superstorm Cpp14 3.77s
29 MathProgrammer Cpp 3.82s
30 emrul Cpp14 3.92s
31 st3inum Cpp14 3.95s
32 Naim1611052 Cpp 3.98s
33 FariD Cpp14 3.99s
Feedback

Your feedback is our precious!



Or call +88 02 9853138 for support