#include <bits/stdc++.h>
using namespace std;
int a[100000], b[100000], x2[100000], y2[100000];
int main() {
int n, k;
long long ansT, ans = 10000000000LL;
cin>>n>>k;
for(int i = 0; i < k; ++i) {
cin>>a[i]>>b[i]>>x2[i]>>y2[i];
a[i]--;b[i]--;
x2[i]--;y2[i]--;
}
for(int j = 1; j < n; ++j)
if(n % j == 0) {
ansT = 0;
for(int i = 0; i < k; ++i)
if((a[i]/j + b[i]/j) % 2 == 0)
++ansT;
ansT = ansT * 2 - k;
if(ansT + (long long)n * n / j / j / 2 * j * j < ans)
ans = ansT + (long long)n * n / j / j / 2 * j * j;
ansT = -ansT;
if(ansT + ((long long)n * n / j / j + 1) / 2 * j * j < ans)
ans = ansT + ((long long)n * n / j / j + 1) / 2 * j * j;
}
cout<<ans<<endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
472 KB |
Output is correct |
3 |
Correct |
2 ms |
504 KB |
Output is correct |
4 |
Correct |
2 ms |
504 KB |
Output is correct |
5 |
Correct |
2 ms |
520 KB |
Output is correct |
6 |
Correct |
2 ms |
520 KB |
Output is correct |
7 |
Correct |
3 ms |
520 KB |
Output is correct |
8 |
Correct |
2 ms |
520 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
94 ms |
1432 KB |
Output is correct |
2 |
Correct |
24 ms |
1432 KB |
Output is correct |
3 |
Correct |
55 ms |
1432 KB |
Output is correct |
4 |
Correct |
57 ms |
1432 KB |
Output is correct |
5 |
Correct |
75 ms |
1488 KB |
Output is correct |
6 |
Correct |
83 ms |
1488 KB |
Output is correct |
7 |
Correct |
20 ms |
1488 KB |
Output is correct |
8 |
Correct |
57 ms |
1488 KB |
Output is correct |
9 |
Correct |
136 ms |
1992 KB |
Output is correct |
10 |
Correct |
80 ms |
1992 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
1992 KB |
Output is correct |
2 |
Correct |
2 ms |
1992 KB |
Output is correct |
3 |
Correct |
2 ms |
1992 KB |
Output is correct |
4 |
Correct |
4 ms |
1992 KB |
Output is correct |
5 |
Correct |
3 ms |
1992 KB |
Output is correct |
6 |
Correct |
2 ms |
1992 KB |
Output is correct |
7 |
Correct |
4 ms |
1992 KB |
Output is correct |
8 |
Correct |
3 ms |
1992 KB |
Output is correct |
9 |
Correct |
3 ms |
1992 KB |
Output is correct |
10 |
Correct |
2 ms |
1992 KB |
Output is correct |
11 |
Correct |
3 ms |
1992 KB |
Output is correct |
12 |
Correct |
4 ms |
1992 KB |
Output is correct |
13 |
Correct |
4 ms |
1992 KB |
Output is correct |
14 |
Correct |
5 ms |
1992 KB |
Output is correct |
15 |
Correct |
4 ms |
1992 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
1992 KB |
Output is correct |
2 |
Correct |
2 ms |
1992 KB |
Output is correct |
3 |
Correct |
2 ms |
1992 KB |
Output is correct |
4 |
Correct |
4 ms |
1992 KB |
Output is correct |
5 |
Correct |
3 ms |
1992 KB |
Output is correct |
6 |
Correct |
2 ms |
1992 KB |
Output is correct |
7 |
Correct |
4 ms |
1992 KB |
Output is correct |
8 |
Correct |
3 ms |
1992 KB |
Output is correct |
9 |
Correct |
3 ms |
1992 KB |
Output is correct |
10 |
Correct |
2 ms |
1992 KB |
Output is correct |
11 |
Correct |
3 ms |
1992 KB |
Output is correct |
12 |
Correct |
4 ms |
1992 KB |
Output is correct |
13 |
Correct |
4 ms |
1992 KB |
Output is correct |
14 |
Correct |
5 ms |
1992 KB |
Output is correct |
15 |
Correct |
4 ms |
1992 KB |
Output is correct |
16 |
Correct |
34 ms |
1992 KB |
Output is correct |
17 |
Correct |
126 ms |
1992 KB |
Output is correct |
18 |
Correct |
139 ms |
2172 KB |
Output is correct |
19 |
Correct |
133 ms |
2172 KB |
Output is correct |
20 |
Correct |
130 ms |
2292 KB |
Output is correct |
21 |
Correct |
88 ms |
2292 KB |
Output is correct |
22 |
Correct |
3 ms |
2292 KB |
Output is correct |
23 |
Correct |
52 ms |
2292 KB |
Output is correct |
24 |
Correct |
101 ms |
2292 KB |
Output is correct |
25 |
Correct |
14 ms |
2292 KB |
Output is correct |
26 |
Correct |
70 ms |
2292 KB |
Output is correct |
27 |
Correct |
75 ms |
2292 KB |
Output is correct |
28 |
Correct |
117 ms |
2292 KB |
Output is correct |
29 |
Correct |
50 ms |
2292 KB |
Output is correct |
30 |
Correct |
5 ms |
2292 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
94 ms |
1432 KB |
Output is correct |
2 |
Correct |
24 ms |
1432 KB |
Output is correct |
3 |
Correct |
55 ms |
1432 KB |
Output is correct |
4 |
Correct |
57 ms |
1432 KB |
Output is correct |
5 |
Correct |
75 ms |
1488 KB |
Output is correct |
6 |
Correct |
83 ms |
1488 KB |
Output is correct |
7 |
Correct |
20 ms |
1488 KB |
Output is correct |
8 |
Correct |
57 ms |
1488 KB |
Output is correct |
9 |
Correct |
136 ms |
1992 KB |
Output is correct |
10 |
Correct |
80 ms |
1992 KB |
Output is correct |
11 |
Correct |
3 ms |
1992 KB |
Output is correct |
12 |
Correct |
2 ms |
1992 KB |
Output is correct |
13 |
Correct |
2 ms |
1992 KB |
Output is correct |
14 |
Correct |
4 ms |
1992 KB |
Output is correct |
15 |
Correct |
3 ms |
1992 KB |
Output is correct |
16 |
Correct |
2 ms |
1992 KB |
Output is correct |
17 |
Correct |
4 ms |
1992 KB |
Output is correct |
18 |
Correct |
3 ms |
1992 KB |
Output is correct |
19 |
Correct |
3 ms |
1992 KB |
Output is correct |
20 |
Correct |
2 ms |
1992 KB |
Output is correct |
21 |
Correct |
3 ms |
1992 KB |
Output is correct |
22 |
Correct |
4 ms |
1992 KB |
Output is correct |
23 |
Correct |
4 ms |
1992 KB |
Output is correct |
24 |
Correct |
5 ms |
1992 KB |
Output is correct |
25 |
Correct |
4 ms |
1992 KB |
Output is correct |
26 |
Correct |
34 ms |
1992 KB |
Output is correct |
27 |
Correct |
126 ms |
1992 KB |
Output is correct |
28 |
Correct |
139 ms |
2172 KB |
Output is correct |
29 |
Correct |
133 ms |
2172 KB |
Output is correct |
30 |
Correct |
130 ms |
2292 KB |
Output is correct |
31 |
Correct |
88 ms |
2292 KB |
Output is correct |
32 |
Correct |
3 ms |
2292 KB |
Output is correct |
33 |
Correct |
52 ms |
2292 KB |
Output is correct |
34 |
Correct |
101 ms |
2292 KB |
Output is correct |
35 |
Correct |
14 ms |
2292 KB |
Output is correct |
36 |
Correct |
70 ms |
2292 KB |
Output is correct |
37 |
Correct |
75 ms |
2292 KB |
Output is correct |
38 |
Correct |
117 ms |
2292 KB |
Output is correct |
39 |
Correct |
50 ms |
2292 KB |
Output is correct |
40 |
Correct |
5 ms |
2292 KB |
Output is correct |
41 |
Correct |
144 ms |
3896 KB |
Output is correct |
42 |
Correct |
160 ms |
6452 KB |
Output is correct |
43 |
Correct |
138 ms |
8360 KB |
Output is correct |
44 |
Correct |
156 ms |
10692 KB |
Output is correct |
45 |
Correct |
154 ms |
13068 KB |
Output is correct |
46 |
Correct |
179 ms |
15172 KB |
Output is correct |
47 |
Correct |
141 ms |
17116 KB |
Output is correct |
48 |
Correct |
148 ms |
19312 KB |
Output is correct |
49 |
Correct |
137 ms |
21332 KB |
Output is correct |
50 |
Correct |
229 ms |
23540 KB |
Output is correct |
51 |
Correct |
249 ms |
25964 KB |
Output is correct |
52 |
Correct |
229 ms |
28020 KB |
Output is correct |
53 |
Correct |
280 ms |
30388 KB |
Output is correct |
54 |
Correct |
232 ms |
32500 KB |
Output is correct |
55 |
Correct |
244 ms |
35092 KB |
Output is correct |
56 |
Correct |
203 ms |
36896 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
472 KB |
Output is correct |
3 |
Correct |
2 ms |
504 KB |
Output is correct |
4 |
Correct |
2 ms |
504 KB |
Output is correct |
5 |
Correct |
2 ms |
520 KB |
Output is correct |
6 |
Correct |
2 ms |
520 KB |
Output is correct |
7 |
Correct |
3 ms |
520 KB |
Output is correct |
8 |
Correct |
2 ms |
520 KB |
Output is correct |
9 |
Correct |
94 ms |
1432 KB |
Output is correct |
10 |
Correct |
24 ms |
1432 KB |
Output is correct |
11 |
Correct |
55 ms |
1432 KB |
Output is correct |
12 |
Correct |
57 ms |
1432 KB |
Output is correct |
13 |
Correct |
75 ms |
1488 KB |
Output is correct |
14 |
Correct |
83 ms |
1488 KB |
Output is correct |
15 |
Correct |
20 ms |
1488 KB |
Output is correct |
16 |
Correct |
57 ms |
1488 KB |
Output is correct |
17 |
Correct |
136 ms |
1992 KB |
Output is correct |
18 |
Correct |
80 ms |
1992 KB |
Output is correct |
19 |
Correct |
3 ms |
1992 KB |
Output is correct |
20 |
Correct |
2 ms |
1992 KB |
Output is correct |
21 |
Correct |
2 ms |
1992 KB |
Output is correct |
22 |
Correct |
4 ms |
1992 KB |
Output is correct |
23 |
Correct |
3 ms |
1992 KB |
Output is correct |
24 |
Correct |
2 ms |
1992 KB |
Output is correct |
25 |
Correct |
4 ms |
1992 KB |
Output is correct |
26 |
Correct |
3 ms |
1992 KB |
Output is correct |
27 |
Correct |
3 ms |
1992 KB |
Output is correct |
28 |
Correct |
2 ms |
1992 KB |
Output is correct |
29 |
Correct |
3 ms |
1992 KB |
Output is correct |
30 |
Correct |
4 ms |
1992 KB |
Output is correct |
31 |
Correct |
4 ms |
1992 KB |
Output is correct |
32 |
Correct |
5 ms |
1992 KB |
Output is correct |
33 |
Correct |
4 ms |
1992 KB |
Output is correct |
34 |
Correct |
34 ms |
1992 KB |
Output is correct |
35 |
Correct |
126 ms |
1992 KB |
Output is correct |
36 |
Correct |
139 ms |
2172 KB |
Output is correct |
37 |
Correct |
133 ms |
2172 KB |
Output is correct |
38 |
Correct |
130 ms |
2292 KB |
Output is correct |
39 |
Correct |
88 ms |
2292 KB |
Output is correct |
40 |
Correct |
3 ms |
2292 KB |
Output is correct |
41 |
Correct |
52 ms |
2292 KB |
Output is correct |
42 |
Correct |
101 ms |
2292 KB |
Output is correct |
43 |
Correct |
14 ms |
2292 KB |
Output is correct |
44 |
Correct |
70 ms |
2292 KB |
Output is correct |
45 |
Correct |
75 ms |
2292 KB |
Output is correct |
46 |
Correct |
117 ms |
2292 KB |
Output is correct |
47 |
Correct |
50 ms |
2292 KB |
Output is correct |
48 |
Correct |
5 ms |
2292 KB |
Output is correct |
49 |
Correct |
144 ms |
3896 KB |
Output is correct |
50 |
Correct |
160 ms |
6452 KB |
Output is correct |
51 |
Correct |
138 ms |
8360 KB |
Output is correct |
52 |
Correct |
156 ms |
10692 KB |
Output is correct |
53 |
Correct |
154 ms |
13068 KB |
Output is correct |
54 |
Correct |
179 ms |
15172 KB |
Output is correct |
55 |
Correct |
141 ms |
17116 KB |
Output is correct |
56 |
Correct |
148 ms |
19312 KB |
Output is correct |
57 |
Correct |
137 ms |
21332 KB |
Output is correct |
58 |
Correct |
229 ms |
23540 KB |
Output is correct |
59 |
Correct |
249 ms |
25964 KB |
Output is correct |
60 |
Correct |
229 ms |
28020 KB |
Output is correct |
61 |
Correct |
280 ms |
30388 KB |
Output is correct |
62 |
Correct |
232 ms |
32500 KB |
Output is correct |
63 |
Correct |
244 ms |
35092 KB |
Output is correct |
64 |
Correct |
203 ms |
36896 KB |
Output is correct |
65 |
Correct |
2 ms |
36896 KB |
Output is correct |
66 |
Incorrect |
2 ms |
36896 KB |
Output isn't correct |
67 |
Halted |
0 ms |
0 KB |
- |