NC222438. [USACOFeb2021G]CounttheCows
描述
x 012345678 0 101000101 1 010000010 2 101000101 3 000101000 y 4 000010000 5 000101000 6 101000101 7 010000010 8 101000101
FJ is curious how many cows are present in certain regions of his pasture. He asks Q queries, each consisting of three integers xi,yi,di. For each query, FJ wants to know how many cows lie in the cells along the diagonal range from (xi,yi) to (xi+di,yi+di) (endpoints inclusive).
输入描述
The first line contains Q (1≤Q≤104), the number of queries.
The next Q lines each contain three integers di, xi, and yi (0≤xi,yi,di≤1018).
输出描述
Q lines, one for each query.
示例1
输入:
8 10 0 0 10 0 1 9 0 2 8 0 2 0 1 7 1 1 7 2 1 7 1000000000000000000 1000000000000000000 1000000000000000000
输出:
11 0 4 3 1 2 2 1000000000000000001