F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Wool

Time Limit: 8000/4000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)
Total Submission(s): 1089    Accepted Submission(s): 343


Problem Description
At dawn, Venus sets a second task for Psyche.

She is to cross a river and fetch golden wool from violent sheep who graze on the other side.

The sheep are wild and tameless, so Psyche keeps on throwing sticks to keep them away.

There are $ n $ sticks on the ground, the length of the $ i $-th stick is $ a_i $.

If the new stick she throws forms a triangle with any two sticks on the ground, the sheep will be irritated and attack her.

Psyche wants to throw a new stick whose length is within the interval $ [L, R] $. Help her calculate the number of valid sticks she can throw next time.
 

Input
The first line of input contains an integer $ T $ $ (1 \le T \le 10) $, which denotes the number of test cases.

For each test case, the first line of input contains single integer $ n, L, R $ $ (2 \le n \le 10 ^ 5, 1 \le L \le R \le 10 ^ {18}) $.

The second line contains $ n $ integers, the $ i $-th integer denotes $ a_i $ $ (1 \le a_i \le 10 ^ {18}) $.
 

Output
For each test case, print the number of ways to throw a stick.
 

Sample Input
2 2 1 3 1 1 4 3 10 1 1 2 4
 

Sample Output
2 5
 

Hint

In the first example, $ 2, 3 $ are available.

In the second example, $ 6, 7, 8, 9, 10 $ are available.
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-05-03 20:01:17, Gzip enabled