Submission #855850

# Submission time Handle Problem Language Result Execution time Memory
855850 2023-10-02T03:20:14 Z Trisanu_Das Chessboard (IZhO18_chessboard) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
 
signed main() {
	int n, k; cin >> n >> k;
	int ans = n * n;
	array<int, 4> a[k];
	for(auto &[i, j, k, l] : a) cin >> i >> j >> k >> l;
	for(int i = 1; i < n; i++) if(!(n % i)) {
#define c(V) (s * ((V) / (2 * s)) + min(s, (V) % (2 * s)))
		int t = c(n) * (n - c(n)) + c(n) * (n - c(n));
		for(auto [i, j, k, l] : a) {
			int u = k - i + 1, x = c(k) - c(i - 1);
			int v = l - j + 1, y = c(l) - c(j - 1);
			t += 2 * (x * y + (u - x) * (v - y)) - u * v;
		}
		ans = min(ans, min(t, n * n - t));
	}
	cout << ans << '\n';
}

Compilation message

chessboard.cpp: In function 'int main()':
chessboard.cpp:11:15: error: 's' was not declared in this scope
   11 | #define c(V) (s * ((V) / (2 * s)) + min(s, (V) % (2 * s)))
      |               ^
chessboard.cpp:12:11: note: in expansion of macro 'c'
   12 |   int t = c(n) * (n - c(n)) + c(n) * (n - c(n));
      |           ^