#P7556. [USACO21OPEN] Do You Know Your ABCs? S
[USACO21OPEN] Do You Know Your ABCs? S
Description
Farmer John’s cows are holding their daily meeting on the mooZ video conferencing platform. They have invented a simple number game to make the meeting more fun.
Elsie has three positive integers , , and (). These numbers are secret, and she will not tell them directly to her sister Bessie. She tells Bessie () distinct integers (), and claims that each is one of , , , , , , or . However, Elsie may be lying; these integers might not correspond to any valid .
Bessie cannot figure it out, so you need to compute the number of triples that are consistent with the numbers Elsie provided.
Each input contains () test cases that must be solved independently.
Input Format
The first line of input contains .
For each test case, the first line contains , the number of integers Elsie gave to Bessie.
The second line of each test case contains distinct integers .
Output Format
For each test case, output the number of triples that are consistent with the numbers Elsie provided.
10
7
1 2 3 4 5 6 7
4
4 5 7 8
4
4 5 7 9
4
4 5 7 10
4
4 5 7 11
4
4 5 7 12
4
4 5 7 13
4
4 5 7 14
4
4 5 7 15
4
4 5 7 16
1
3
5
1
4
3
0
0
0
1
Hint
Sample Explanation
For , the five possible triples are:
$$(2, 2, 5), (2, 3, 4), (2, 4, 5), (3, 4, 5), (4, 5, 7).$$Test Point Properties
- In test points , all are at most .
- Test points satisfy .
- Test points have no additional constraints.
Notes
Problem author: Benjamin Qi.
Translated by ChatGPT 5
京公网安备 11011102002149号