#include <bits/stdc++.h>
#define pb push_back
#define ios ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define all(data) data.begin() , data.end()
#define endl '\n'
//freopen("nenokku_easy.in", "r", stdin);
//freopen("nenokku_easy.out", "w", stdout);
#define int long long
using namespace std;
typedef long long ll;
const int N = 1e5 + 5;
int n, k, y[N], x[N];
main() {
/*ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);*/
cin >> n >> k;
int even = 0, odd = 0;
for(int i = 1; i <= k; i++) {
int xx, yy;
cin >> x[i] >> y[i] >> xx >> yy;
if(xx % 2 == yy % 2) ++odd;
else even++;
}
int ev = (n * n + 1) / 2, od = (n * n) / 2;
cout << min(ev - odd + even, od - even + odd);
}
/*
5
2 8 5 1 10
5
2 3 5 3
2 5 3 3
1 4 4
2 3 4 2
1 1 2
*/
Compilation message
chessboard.cpp:17:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
17 | main() {
| ^~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
69 ms |
1292 KB |
Output is correct |
2 |
Correct |
21 ms |
532 KB |
Output is correct |
3 |
Correct |
45 ms |
848 KB |
Output is correct |
4 |
Correct |
43 ms |
928 KB |
Output is correct |
5 |
Correct |
62 ms |
1108 KB |
Output is correct |
6 |
Correct |
39 ms |
720 KB |
Output is correct |
7 |
Correct |
8 ms |
312 KB |
Output is correct |
8 |
Correct |
55 ms |
716 KB |
Output is correct |
9 |
Correct |
107 ms |
1584 KB |
Output is correct |
10 |
Correct |
51 ms |
1028 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
69 ms |
1292 KB |
Output is correct |
2 |
Correct |
21 ms |
532 KB |
Output is correct |
3 |
Correct |
45 ms |
848 KB |
Output is correct |
4 |
Correct |
43 ms |
928 KB |
Output is correct |
5 |
Correct |
62 ms |
1108 KB |
Output is correct |
6 |
Correct |
39 ms |
720 KB |
Output is correct |
7 |
Correct |
8 ms |
312 KB |
Output is correct |
8 |
Correct |
55 ms |
716 KB |
Output is correct |
9 |
Correct |
107 ms |
1584 KB |
Output is correct |
10 |
Correct |
51 ms |
1028 KB |
Output is correct |
11 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |