P4465Destroy the cube | |
|
Description
Input Format
The first line contains a positive integer T(1≤T≤5), denoting the number of test cases.
For each test case:
The first line contains two positive integers n,t(1≤n≤6×10^4,1≤t≤1.2×10^5).
The next t lines, each line contains two positive integers x,y(1≤x≤y≤⌊(n+1)/2⌋), denoting a given black position.
Output Format
For each test case:
A single line contains a nonnegative integer, denoting the answer.
Sample Input
2
3 1
2 2
5 2
2 3
3 3
Sample Output
20
76
Source 2017 Multi7 杭州二中