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 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

57/346

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 manu_sy Cpp 2.50s
17 Masum_ice Cpp 2.73s
18 rohijulislam Cpp 2.81s
19 shahadat191 Cpp 2.90s
20 atiqurrahman Cpp 2.93s
21 anik_JU Cpp 3.10s
22 Reayz Cpp 3.38s
23 ashishgup Cpp 3.39s
24 hrOarr Cpp 3.47s
25 Fazle Cpp14 3.53s
26 ksohan Cpp 3.58s
27 robin_aust Cpp14 3.62s
28 mir003 Cpp 3.67s
29 Superstorm Cpp14 3.77s
30 MathProgrammer Cpp 3.82s
31 emrul Cpp14 3.92s
32 st3inum Cpp14 3.95s
33 Naim1611052 Cpp 3.98s
34 FariD Cpp14 3.99s
Feedback