Submission #524881

# Submission time Handle Problem Language Result Execution time Memory
524881 2022-02-10T07:59:34 Z boykut Chessboard (IZhO18_chessboard) C++14
0 / 100
19 ms 2724 KB
#include <iostream>
#include <vector>

using namespace std;

const int N = 100000;
int x1[N], y1[N], x2[N], y2[N];

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

	int n, k;
	cin >> n >> k;
	int mx = 0;
	for (int i = 0; i < k; i++) {
		cin >> x1[i] >> y1[i] >> x2[i] >> y2[i];
		mx = max((x2[i] - x1[i] + 1) * (y2[i] - y1[i] + 1), mx);
	}

	vector<int> D;
	for (int i = 1; i < n; i++) {
		if (n % i == 0) D.push_back(i);
	}

	if (n <= 100 && k == 0) {
		int ans = n;
		for (int d : D) {
			int cnt[] = {0, 0};
			int x = 1;
			for (int i = 1; i * d <= n; i++) {
				for (int j = 1; j * d <= n; j++) {
					if (i % 2 == j % 2) cnt[1] += d * d;
					else cnt[0] += d * d;
				}
			}
			ans = min(ans, min(cnt[0], cnt[1]));
		}
		cout << ans << '\n';
	} else if (D.size() == 1 && mx <= 1) {

	}

	return 0;
}

Compilation message

chessboard.cpp: In function 'int main()':
chessboard.cpp:30:8: warning: unused variable 'x' [-Wunused-variable]
   30 |    int x = 1;
      |        ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 304 KB Output is correct
2 Incorrect 1 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 19 ms 2724 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 316 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 316 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 19 ms 2724 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 304 KB Output is correct
2 Incorrect 1 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -