#include <bits/stdc++.h>
using namespace std;
#define maxn 105
int n, k;
int chess[maxn][maxn];
void solve_k0(){
int minimo = 999999;
for(int i = 1; i < n; i++){
if(n % i != 0) continue;
int test = i*i;
minimo = min(minimo, ((n*n/test)/2)*test);
}
cout << minimo << endl;
}
int main(){
memset(chess, 0, sizeof chess);
cin >> n >> k;
if(k == 0) solve_k0();
else{
for(int i = 0; i < k; i++){
int x, y, l, m;
cin >> x >> y;
cin >> l >> m; //8)
chess[x][y] = 1;
}
int cont_errado = 0;
for(int i = 1; i <= n; i++)
for(int j = 1; j <= n; j++)
if((i+j)%2 == chess[i][j]) cont_errado++;
cout << min(cont_errado, n*n - cont_errado) << endl;
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
384 KB |
Output is correct |
4 |
Correct |
0 ms |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
0 ms |
384 KB |
Output is correct |
7 |
Correct |
0 ms |
384 KB |
Output is correct |
8 |
Correct |
1 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
512 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
512 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
384 KB |
Output is correct |
4 |
Correct |
0 ms |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
0 ms |
384 KB |
Output is correct |
7 |
Correct |
0 ms |
384 KB |
Output is correct |
8 |
Correct |
1 ms |
384 KB |
Output is correct |
9 |
Runtime error |
1 ms |
512 KB |
Execution killed with signal 11 |
10 |
Halted |
0 ms |
0 KB |
- |