Submission #1108416

# Submission time Handle Problem Language Result Execution time Memory
1108416 2024-11-04T04:56:10 Z Muhammet Chessboard (IZhO18_chessboard) C++17
47 / 100
47 ms 2012 KB
#include <bits/stdc++.h>

using namespace std;

#define ll long long

int main(){
	ios::sync_with_stdio(false); cin.tie(nullptr);

	ll n, k;
	cin >> n >> k;
	vector <int> x1(k+1), y1(k+1), x2(k+1), y2(k+1);
	for(int i = 1; i <= k; i++){
		cin >> x1[i] >> y1[i] >> x2[i] >> y2[i];
	}
	ll ans = n, n1 = n;
	ans *= n;
	n1 *= n;
	for(int x3 = 1; x3 < n; x3++){
		if(n % x3 != 0) continue;
		int x = (x3 * 2), cnt1 = 0, cnt2 = 0;
		for(int i = 1; i <= k; i++){
			if((x1[i] % x) <= (x / 2) and (x1[i] % x) != 0){
				if((y1[i] % x) <= (x / 2) and (y1[i] % x) != 0) cnt1++;
				else cnt2++;
			}
			else {
				if((y1[i] % x) <= (x / 2) and (y1[i] % x) != 0) cnt2++;
				else cnt1++;
			}
		}
		ll y = ((x3 * x3) * (((n / x3) + 1) / 2) * (((n / x3) + 1) / 2)) + ((x3 * x3) * ((n / x3) / 2) * ((n / x3) / 2));
		ans = min(ans, (y - cnt1 + cnt2));
		ans = min(ans, (n1 - y) - cnt2 + cnt1);
	}
	cout << ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 516 KB Output is correct
3 Correct 0 ms 336 KB Output is correct
4 Correct 1 ms 508 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 13 ms 1360 KB Output is correct
2 Correct 5 ms 592 KB Output is correct
3 Correct 12 ms 848 KB Output is correct
4 Correct 11 ms 1184 KB Output is correct
5 Correct 14 ms 1104 KB Output is correct
6 Correct 8 ms 1008 KB Output is correct
7 Correct 2 ms 336 KB Output is correct
8 Correct 8 ms 848 KB Output is correct
9 Correct 20 ms 1872 KB Output is correct
10 Correct 12 ms 1104 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 7 ms 848 KB Output is correct
17 Correct 19 ms 1616 KB Output is correct
18 Correct 20 ms 2012 KB Output is correct
19 Correct 47 ms 1616 KB Output is correct
20 Correct 46 ms 2012 KB Output is correct
21 Correct 16 ms 1616 KB Output is correct
22 Correct 1 ms 336 KB Output is correct
23 Correct 11 ms 1104 KB Output is correct
24 Correct 19 ms 1616 KB Output is correct
25 Correct 3 ms 592 KB Output is correct
26 Correct 15 ms 1356 KB Output is correct
27 Correct 22 ms 1360 KB Output is correct
28 Correct 21 ms 1872 KB Output is correct
29 Correct 7 ms 848 KB Output is correct
30 Correct 1 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 13 ms 1360 KB Output is correct
2 Correct 5 ms 592 KB Output is correct
3 Correct 12 ms 848 KB Output is correct
4 Correct 11 ms 1184 KB Output is correct
5 Correct 14 ms 1104 KB Output is correct
6 Correct 8 ms 1008 KB Output is correct
7 Correct 2 ms 336 KB Output is correct
8 Correct 8 ms 848 KB Output is correct
9 Correct 20 ms 1872 KB Output is correct
10 Correct 12 ms 1104 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 1 ms 336 KB Output is correct
17 Correct 1 ms 336 KB Output is correct
18 Correct 1 ms 336 KB Output is correct
19 Correct 1 ms 336 KB Output is correct
20 Correct 1 ms 336 KB Output is correct
21 Correct 1 ms 336 KB Output is correct
22 Correct 1 ms 336 KB Output is correct
23 Correct 1 ms 336 KB Output is correct
24 Correct 1 ms 336 KB Output is correct
25 Correct 1 ms 336 KB Output is correct
26 Correct 7 ms 848 KB Output is correct
27 Correct 19 ms 1616 KB Output is correct
28 Correct 20 ms 2012 KB Output is correct
29 Correct 47 ms 1616 KB Output is correct
30 Correct 46 ms 2012 KB Output is correct
31 Correct 16 ms 1616 KB Output is correct
32 Correct 1 ms 336 KB Output is correct
33 Correct 11 ms 1104 KB Output is correct
34 Correct 19 ms 1616 KB Output is correct
35 Correct 3 ms 592 KB Output is correct
36 Correct 15 ms 1356 KB Output is correct
37 Correct 22 ms 1360 KB Output is correct
38 Correct 21 ms 1872 KB Output is correct
39 Correct 7 ms 848 KB Output is correct
40 Correct 1 ms 336 KB Output is correct
41 Incorrect 44 ms 1616 KB Output isn't correct
42 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 516 KB Output is correct
3 Correct 0 ms 336 KB Output is correct
4 Correct 1 ms 508 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 13 ms 1360 KB Output is correct
10 Correct 5 ms 592 KB Output is correct
11 Correct 12 ms 848 KB Output is correct
12 Correct 11 ms 1184 KB Output is correct
13 Correct 14 ms 1104 KB Output is correct
14 Correct 8 ms 1008 KB Output is correct
15 Correct 2 ms 336 KB Output is correct
16 Correct 8 ms 848 KB Output is correct
17 Correct 20 ms 1872 KB Output is correct
18 Correct 12 ms 1104 KB Output is correct
19 Correct 1 ms 336 KB Output is correct
20 Correct 1 ms 336 KB Output is correct
21 Correct 1 ms 336 KB Output is correct
22 Correct 1 ms 336 KB Output is correct
23 Correct 1 ms 336 KB Output is correct
24 Correct 1 ms 336 KB Output is correct
25 Correct 1 ms 336 KB Output is correct
26 Correct 1 ms 336 KB Output is correct
27 Correct 1 ms 336 KB Output is correct
28 Correct 1 ms 336 KB Output is correct
29 Correct 1 ms 336 KB Output is correct
30 Correct 1 ms 336 KB Output is correct
31 Correct 1 ms 336 KB Output is correct
32 Correct 1 ms 336 KB Output is correct
33 Correct 1 ms 336 KB Output is correct
34 Correct 7 ms 848 KB Output is correct
35 Correct 19 ms 1616 KB Output is correct
36 Correct 20 ms 2012 KB Output is correct
37 Correct 47 ms 1616 KB Output is correct
38 Correct 46 ms 2012 KB Output is correct
39 Correct 16 ms 1616 KB Output is correct
40 Correct 1 ms 336 KB Output is correct
41 Correct 11 ms 1104 KB Output is correct
42 Correct 19 ms 1616 KB Output is correct
43 Correct 3 ms 592 KB Output is correct
44 Correct 15 ms 1356 KB Output is correct
45 Correct 22 ms 1360 KB Output is correct
46 Correct 21 ms 1872 KB Output is correct
47 Correct 7 ms 848 KB Output is correct
48 Correct 1 ms 336 KB Output is correct
49 Incorrect 44 ms 1616 KB Output isn't correct
50 Halted 0 ms 0 KB -