답안 #1108417

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1108417 2024-11-04T04:57:18 Z Muhammet Chessboard (IZhO18_chessboard) C++17
70 / 100
175 ms 6064 KB
#include <bits/stdc++.h>

using namespace std;

#define int long long

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

	int 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];
	}
	int 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++;
			}
		}
		int 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;
}
# 결과 실행 시간 메모리 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 0 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 16 ms 2384 KB Output is correct
2 Correct 4 ms 848 KB Output is correct
3 Correct 10 ms 1616 KB Output is correct
4 Correct 10 ms 1900 KB Output is correct
5 Correct 21 ms 2300 KB Output is correct
6 Correct 9 ms 1360 KB Output is correct
7 Correct 2 ms 592 KB Output is correct
8 Correct 8 ms 1360 KB Output is correct
9 Correct 20 ms 3296 KB Output is correct
10 Correct 11 ms 1872 KB Output is correct
# 결과 실행 시간 메모리 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 500 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
# 결과 실행 시간 메모리 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 500 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 6 ms 1272 KB Output is correct
17 Correct 16 ms 2896 KB Output is correct
18 Correct 21 ms 3408 KB Output is correct
19 Correct 43 ms 3320 KB Output is correct
20 Correct 59 ms 3408 KB Output is correct
21 Correct 17 ms 2896 KB Output is correct
22 Correct 1 ms 336 KB Output is correct
23 Correct 12 ms 1792 KB Output is correct
24 Correct 19 ms 3152 KB Output is correct
25 Correct 3 ms 592 KB Output is correct
26 Correct 12 ms 2128 KB Output is correct
27 Correct 18 ms 2384 KB Output is correct
28 Correct 22 ms 3584 KB Output is correct
29 Correct 7 ms 1360 KB Output is correct
30 Correct 1 ms 336 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 16 ms 2384 KB Output is correct
2 Correct 4 ms 848 KB Output is correct
3 Correct 10 ms 1616 KB Output is correct
4 Correct 10 ms 1900 KB Output is correct
5 Correct 21 ms 2300 KB Output is correct
6 Correct 9 ms 1360 KB Output is correct
7 Correct 2 ms 592 KB Output is correct
8 Correct 8 ms 1360 KB Output is correct
9 Correct 20 ms 3296 KB Output is correct
10 Correct 11 ms 1872 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 500 KB Output is correct
24 Correct 1 ms 336 KB Output is correct
25 Correct 1 ms 336 KB Output is correct
26 Correct 6 ms 1272 KB Output is correct
27 Correct 16 ms 2896 KB Output is correct
28 Correct 21 ms 3408 KB Output is correct
29 Correct 43 ms 3320 KB Output is correct
30 Correct 59 ms 3408 KB Output is correct
31 Correct 17 ms 2896 KB Output is correct
32 Correct 1 ms 336 KB Output is correct
33 Correct 12 ms 1792 KB Output is correct
34 Correct 19 ms 3152 KB Output is correct
35 Correct 3 ms 592 KB Output is correct
36 Correct 12 ms 2128 KB Output is correct
37 Correct 18 ms 2384 KB Output is correct
38 Correct 22 ms 3584 KB Output is correct
39 Correct 7 ms 1360 KB Output is correct
40 Correct 1 ms 336 KB Output is correct
41 Correct 41 ms 3064 KB Output is correct
42 Correct 27 ms 5580 KB Output is correct
43 Correct 32 ms 4968 KB Output is correct
44 Correct 32 ms 5448 KB Output is correct
45 Correct 26 ms 5724 KB Output is correct
46 Correct 48 ms 5456 KB Output is correct
47 Correct 21 ms 5200 KB Output is correct
48 Correct 29 ms 3920 KB Output is correct
49 Correct 23 ms 4944 KB Output is correct
50 Correct 160 ms 5192 KB Output is correct
51 Correct 175 ms 6064 KB Output is correct
52 Correct 156 ms 5200 KB Output is correct
53 Correct 162 ms 5200 KB Output is correct
54 Correct 150 ms 5200 KB Output is correct
55 Correct 172 ms 5712 KB Output is correct
56 Correct 146 ms 4976 KB Output is correct
# 결과 실행 시간 메모리 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 0 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 16 ms 2384 KB Output is correct
10 Correct 4 ms 848 KB Output is correct
11 Correct 10 ms 1616 KB Output is correct
12 Correct 10 ms 1900 KB Output is correct
13 Correct 21 ms 2300 KB Output is correct
14 Correct 9 ms 1360 KB Output is correct
15 Correct 2 ms 592 KB Output is correct
16 Correct 8 ms 1360 KB Output is correct
17 Correct 20 ms 3296 KB Output is correct
18 Correct 11 ms 1872 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 500 KB Output is correct
32 Correct 1 ms 336 KB Output is correct
33 Correct 1 ms 336 KB Output is correct
34 Correct 6 ms 1272 KB Output is correct
35 Correct 16 ms 2896 KB Output is correct
36 Correct 21 ms 3408 KB Output is correct
37 Correct 43 ms 3320 KB Output is correct
38 Correct 59 ms 3408 KB Output is correct
39 Correct 17 ms 2896 KB Output is correct
40 Correct 1 ms 336 KB Output is correct
41 Correct 12 ms 1792 KB Output is correct
42 Correct 19 ms 3152 KB Output is correct
43 Correct 3 ms 592 KB Output is correct
44 Correct 12 ms 2128 KB Output is correct
45 Correct 18 ms 2384 KB Output is correct
46 Correct 22 ms 3584 KB Output is correct
47 Correct 7 ms 1360 KB Output is correct
48 Correct 1 ms 336 KB Output is correct
49 Correct 41 ms 3064 KB Output is correct
50 Correct 27 ms 5580 KB Output is correct
51 Correct 32 ms 4968 KB Output is correct
52 Correct 32 ms 5448 KB Output is correct
53 Correct 26 ms 5724 KB Output is correct
54 Correct 48 ms 5456 KB Output is correct
55 Correct 21 ms 5200 KB Output is correct
56 Correct 29 ms 3920 KB Output is correct
57 Correct 23 ms 4944 KB Output is correct
58 Correct 160 ms 5192 KB Output is correct
59 Correct 175 ms 6064 KB Output is correct
60 Correct 156 ms 5200 KB Output is correct
61 Correct 162 ms 5200 KB Output is correct
62 Correct 150 ms 5200 KB Output is correct
63 Correct 172 ms 5712 KB Output is correct
64 Correct 146 ms 4976 KB Output is correct
65 Correct 1 ms 336 KB Output is correct
66 Incorrect 1 ms 336 KB Output isn't correct
67 Halted 0 ms 0 KB -