Submission #290513

# Submission time Handle Problem Language Result Execution time Memory
290513 2020-09-03T23:01:47 Z matheo_apd Chessboard (IZhO18_chessboard) C++17
16 / 100
210 ms 5880 KB
#include <bits/stdc++.h>
using namespace std;
#define maxn 100005
#define ll long long int
ll n, k;
vector<int> chess[maxn];
void solve_k0(){
	ll 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].push_back(y);
		}
		ll cont = 0;
		for(int i = 1; i <= n; i++){
			ll cont_errado = 0, cont_certo = 0;
			for(int j = 0; j < chess[i].size(); j++){
				//if((i+j)%2 == chess[i][j]) cont_errado++;
				int row = chess[i][j];
				if(i%2 == row%2) cont_certo++;
				else cont_errado++;
			}
			cont += cont_errado	+ n/2 + i%2 - cont_certo;
		}
		cout << min(cont, n*n - cont) << endl;
	}
	return 0;
}

Compilation message

chessboard.cpp: In function 'int main()':
chessboard.cpp:30:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |    for(int j = 0; j < chess[i].size(); j++){
      |                   ~~^~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2688 KB Output is correct
2 Correct 2 ms 2688 KB Output is correct
3 Correct 2 ms 2688 KB Output is correct
4 Correct 2 ms 2688 KB Output is correct
5 Correct 2 ms 2688 KB Output is correct
6 Correct 2 ms 2688 KB Output is correct
7 Correct 2 ms 2688 KB Output is correct
8 Correct 2 ms 2688 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 150 ms 3832 KB Output is correct
2 Correct 39 ms 3320 KB Output is correct
3 Correct 98 ms 4624 KB Output is correct
4 Correct 91 ms 3832 KB Output is correct
5 Correct 132 ms 4984 KB Output is correct
6 Correct 84 ms 4216 KB Output is correct
7 Correct 19 ms 3072 KB Output is correct
8 Correct 85 ms 4344 KB Output is correct
9 Correct 210 ms 5880 KB Output is correct
10 Correct 119 ms 4728 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 2816 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 2816 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 150 ms 3832 KB Output is correct
2 Correct 39 ms 3320 KB Output is correct
3 Correct 98 ms 4624 KB Output is correct
4 Correct 91 ms 3832 KB Output is correct
5 Correct 132 ms 4984 KB Output is correct
6 Correct 84 ms 4216 KB Output is correct
7 Correct 19 ms 3072 KB Output is correct
8 Correct 85 ms 4344 KB Output is correct
9 Correct 210 ms 5880 KB Output is correct
10 Correct 119 ms 4728 KB Output is correct
11 Incorrect 3 ms 2816 KB Output isn't correct
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2688 KB Output is correct
2 Correct 2 ms 2688 KB Output is correct
3 Correct 2 ms 2688 KB Output is correct
4 Correct 2 ms 2688 KB Output is correct
5 Correct 2 ms 2688 KB Output is correct
6 Correct 2 ms 2688 KB Output is correct
7 Correct 2 ms 2688 KB Output is correct
8 Correct 2 ms 2688 KB Output is correct
9 Correct 150 ms 3832 KB Output is correct
10 Correct 39 ms 3320 KB Output is correct
11 Correct 98 ms 4624 KB Output is correct
12 Correct 91 ms 3832 KB Output is correct
13 Correct 132 ms 4984 KB Output is correct
14 Correct 84 ms 4216 KB Output is correct
15 Correct 19 ms 3072 KB Output is correct
16 Correct 85 ms 4344 KB Output is correct
17 Correct 210 ms 5880 KB Output is correct
18 Correct 119 ms 4728 KB Output is correct
19 Incorrect 3 ms 2816 KB Output isn't correct
20 Halted 0 ms 0 KB -