| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 4 초 | 2048 MB | 7 | 4 | 4 | 57.143% |
You have a square of side length $n$ on a 2D plane, partitioned into a grid of 1ドル \times 1$ square cells, totaling $n^2$ cells.
Your task is to answer $q$ queries, numbered from 1ドル$ to $q,ドル described below. In query $i,ドル you are given a real number $s_i,ドル and you must count the number of ways to place four points on the plane such that
Here, the edges of the square formed by these points do not need to be parallel to the edges of the cells. If there are infinitely many valid placements, you must report that as your answer.
Two placements are considered different if there exists a point that appears in one placement but not in the other.
The first line of input contains two integers $n$ and $q$ (1ドル ≤ n ≤ 2000,ドル 1ドル ≤ q ≤ 100,円 000$). The $i$-th of the next $q$ lines contains a real number $s_i$ (0ドル.01 ≤ s_i ≤ n^2$), given with exactly two digits after the decimal point.
Output $q$ lines. The $i$-th line should contain the number of valid placements for query $i$. If infinitely many exist, output -1 instead.
3 4 6.90 0.26 2.65 1.00
2 4 10 -1
For queries 1ドル$ and 2ドル,ドル the valid placements are illustrated in Figure I.1. The top two placements correspond to query 1ドル,ドル and the bottom four correspond to query 2ドル$. In each placement, the shaded region represents a square formed by the points.
Figure I.1: Illustrations of Sample Input #1.
1 5 0.49 0.50 0.51 0.99 1.00
0 1 2 2 1