CF1935D.Exam in MAC
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
The Master's Assistance Center has announced an entrance exam, which consists of the following.
The candidate is given a set s of size n and some strange integer c . For this set, it is needed to calculate the number of pairs of integers (x,y) such that 0≤x≤y≤c , x+y is not contained in the set s , and also y−x is not contained in the set s .
Your friend wants to enter the Center. Help him pass the exam!
输入格式
Each test consists of multiple test cases. The first line contains a single integer t ( 1≤t≤2⋅104 ) — the number of test cases. The description of the test cases follows.
The first line of each test case contains two integers n and c ( 1≤n≤3⋅105 , 1≤c≤109 ) — the size of the set and the strange integer.
The second line of each test case contains n integers s1,s2,…,sn ( 0≤s1<s2<…<sn≤c ) — the elements of the set s .
It is guaranteed that the sum of n over all test cases does not exceed 3⋅105 .
输出格式
For each test case, output a single integer — the number of suitable pairs of integers.
输入输出样例
输入#1
8 3 3 1 2 3 1 179 57 4 6 0 3 5 6 1 1 1 5 10 0 2 4 8 10 5 10 1 3 5 7 9 4 10 2 4 6 7 3 1000000000 228 1337 998244353
输出#1
3 16139 10 2 33 36 35 499999998999122959
说明/提示
In the first test case, the following pairs are suitable: (0,0) , (2,2) , (3,3) .
In the third test case, the following pairs are suitable: (0,1) , (0,2) , (0,4) , (1,3) , (2,6) , (3,4) , (3,5) , (4,5) , (4,6) , (5,6) .