Submission #290496

# Submission time Handle Problem Language Result Execution time Memory
290496 2020-09-03T22:20:11 Z matheo_apd Chessboard (IZhO18_chessboard) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
#define maxn 105
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(){
	int n, k;
	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;
}

Compilation message

chessboard.cpp: In function 'void solve_k0()':
chessboard.cpp:7:21: error: 'n' was not declared in this scope
    7 |  for(int i = 1; i < n; i++){
      |                     ^