Submission #488350

# Submission time Handle Problem Language Result Execution time Memory
488350 2021-11-18T17:01:49 Z levsog2004 Chessboard (IZhO18_chessboard) C++14
39 / 100
60 ms 1484 KB
#include <iostream>
#include <iomanip>
#include <fstream>
#include <algorithm>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <cmath>
#include <list>
#include <set>
#include <map>
using namespace std;
typedef  int  ll;
#define all(x) x.begin(),x.end()
#define al(a,n)  (a,a+n)
#define se second
#define fr first
#define m_p make_pair
const ll N = 1005;
const ll mod = 1000 * 1000 * 1000 + 7;
const ll inf = 1000000009;
ll n, m, k, z, t, x, y, ans, pat,a[N][N];
pair<ll, ll> p[N][N];
vector<pair<ll, ll>> v;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin >> n >> m;
	for (int i = 0; i < m; ++i)
	{
		cin >> x >> y >> x >> y;
		v.push_back({ x-1,y-1 });
	}
	ans = inf;
	for (int ii = 1; ii < n; ++ii)
	{
		x = 0;
		y = 0;
		if (n % ii == 0)
		{
			for (int i = 0; i < m; ++i)
			{
				if ((v[i].first / ii + v[i].second / ii) % 2 == 0)
				{
					x++;
				}
				else
					y++;
			}
			k = n / ii;
			k *= k;
			z = k / 2;
			if (k % 2 == 1)
				z++;
			k /= 2;
			ans = min(ans, min(z*ii*ii-x+y,k*ii*ii-y+x));
		}
	}
	cout << ans << endl;
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 25 ms 1072 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 396 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 0 ms 332 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 1 ms 332 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 1 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 396 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 0 ms 332 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 1 ms 332 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 1 ms 332 KB Output is correct
16 Correct 8 ms 716 KB Output is correct
17 Correct 22 ms 1464 KB Output is correct
18 Correct 27 ms 1384 KB Output is correct
19 Correct 54 ms 1468 KB Output is correct
20 Correct 60 ms 1484 KB Output is correct
21 Correct 19 ms 1380 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
23 Correct 13 ms 976 KB Output is correct
24 Correct 25 ms 1372 KB Output is correct
25 Correct 3 ms 460 KB Output is correct
26 Correct 16 ms 976 KB Output is correct
27 Correct 23 ms 1464 KB Output is correct
28 Correct 31 ms 1484 KB Output is correct
29 Correct 9 ms 976 KB Output is correct
30 Correct 1 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 25 ms 1072 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Incorrect 25 ms 1072 KB Output isn't correct
10 Halted 0 ms 0 KB -