Submission #1108415

# Submission time Handle Problem Language Result Execution time Memory
1108415 2024-11-04T04:53:52 Z Muhammet Chessboard (IZhO18_chessboard) C++17
47 / 100
49 ms 3664 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*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, (n*n - y) - cnt2 + cnt1);
	}
	cout << ans;
}
# 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
# Verdict Execution time Memory Grader output
1 Correct 14 ms 1360 KB Output is correct
2 Correct 5 ms 848 KB Output is correct
3 Correct 10 ms 1968 KB Output is correct
4 Correct 11 ms 1872 KB Output is correct
5 Correct 16 ms 2384 KB Output is correct
6 Correct 9 ms 1616 KB Output is correct
7 Correct 3 ms 592 KB Output is correct
8 Correct 10 ms 1616 KB Output is correct
9 Correct 22 ms 2340 KB Output is correct
10 Correct 12 ms 2384 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 368 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 464 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 504 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 368 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 464 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 504 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 10 ms 1104 KB Output is correct
17 Correct 17 ms 3000 KB Output is correct
18 Correct 25 ms 3240 KB Output is correct
19 Correct 49 ms 3152 KB Output is correct
20 Correct 48 ms 3420 KB Output is correct
21 Correct 16 ms 2896 KB Output is correct
22 Correct 1 ms 336 KB Output is correct
23 Correct 11 ms 1616 KB Output is correct
24 Correct 20 ms 3152 KB Output is correct
25 Correct 4 ms 592 KB Output is correct
26 Correct 13 ms 1924 KB Output is correct
27 Correct 17 ms 2384 KB Output is correct
28 Correct 23 ms 3408 KB Output is correct
29 Correct 8 ms 1360 KB Output is correct
30 Correct 2 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 14 ms 1360 KB Output is correct
2 Correct 5 ms 848 KB Output is correct
3 Correct 10 ms 1968 KB Output is correct
4 Correct 11 ms 1872 KB Output is correct
5 Correct 16 ms 2384 KB Output is correct
6 Correct 9 ms 1616 KB Output is correct
7 Correct 3 ms 592 KB Output is correct
8 Correct 10 ms 1616 KB Output is correct
9 Correct 22 ms 2340 KB Output is correct
10 Correct 12 ms 2384 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 368 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 464 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 504 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 10 ms 1104 KB Output is correct
27 Correct 17 ms 3000 KB Output is correct
28 Correct 25 ms 3240 KB Output is correct
29 Correct 49 ms 3152 KB Output is correct
30 Correct 48 ms 3420 KB Output is correct
31 Correct 16 ms 2896 KB Output is correct
32 Correct 1 ms 336 KB Output is correct
33 Correct 11 ms 1616 KB Output is correct
34 Correct 20 ms 3152 KB Output is correct
35 Correct 4 ms 592 KB Output is correct
36 Correct 13 ms 1924 KB Output is correct
37 Correct 17 ms 2384 KB Output is correct
38 Correct 23 ms 3408 KB Output is correct
39 Correct 8 ms 1360 KB Output is correct
40 Correct 2 ms 336 KB Output is correct
41 Incorrect 44 ms 3664 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 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 14 ms 1360 KB Output is correct
10 Correct 5 ms 848 KB Output is correct
11 Correct 10 ms 1968 KB Output is correct
12 Correct 11 ms 1872 KB Output is correct
13 Correct 16 ms 2384 KB Output is correct
14 Correct 9 ms 1616 KB Output is correct
15 Correct 3 ms 592 KB Output is correct
16 Correct 10 ms 1616 KB Output is correct
17 Correct 22 ms 2340 KB Output is correct
18 Correct 12 ms 2384 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 368 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 464 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 504 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 10 ms 1104 KB Output is correct
35 Correct 17 ms 3000 KB Output is correct
36 Correct 25 ms 3240 KB Output is correct
37 Correct 49 ms 3152 KB Output is correct
38 Correct 48 ms 3420 KB Output is correct
39 Correct 16 ms 2896 KB Output is correct
40 Correct 1 ms 336 KB Output is correct
41 Correct 11 ms 1616 KB Output is correct
42 Correct 20 ms 3152 KB Output is correct
43 Correct 4 ms 592 KB Output is correct
44 Correct 13 ms 1924 KB Output is correct
45 Correct 17 ms 2384 KB Output is correct
46 Correct 23 ms 3408 KB Output is correct
47 Correct 8 ms 1360 KB Output is correct
48 Correct 2 ms 336 KB Output is correct
49 Incorrect 44 ms 3664 KB Output isn't correct
50 Halted 0 ms 0 KB -