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

53/336

Solve/Submission

Ranking

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

Your feedback is our precious!



Or call +88 02 9853138 for support