Given a set of integers, how many different triangles can you construct by using three distinct numbers in the set?
For example, let the set be {1, 3, 4, 5, 7, 8}.
The 7 different triangles can be constructed were (3,4,5), (3,5,7), (4,5,7), (3,7,8), (4,7,8), (5,7,8), (4,5,8).
There are multiple test cases.
The first line of each test case contains two integers N (1<= N<=1000000000) and M (0<= M<=1000).
The second line containing M distinct integers a1, a2, ..., aM.
For each test case, please compute the number of different triangles you can construct
by using the set {1, 2, ..., N} - {a1, a2, ..., aM}.
Output the answer mod 1000000007.
8 2 2 6 58 3 23 5 3
7 13861
Migrated from old NTUJ.
Bee
No. | Testdata Range | Score |
---|