답안 #855835

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
855835 2023-10-02T02:39:25 Z Trisanu_Das Chessboard (IZhO18_chessboard) C++17
컴파일 오류
0 ms 0 KB
#include <iostream>
#include <algorithm>
#include <climits>
using namespace std;
#define int long long
 
const int maxn = 100004;
int n, k, tot, x1[maxn], y1[maxn], x2[maxn], y2[maxn];
 
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	cin >> n >> k;
	for (int i = 0; i < k; i++) {
		cin >> x1[i] >> y1[i] >> x2[i] >> y2[i];
		x1[i]--; y1[i]--; x2[i]--; y2[i]--;
		s += (x2[i] - x1[i] + 1) * (y2[i] - y1[i] + 1);
	}
	int ans = LLONG_MAX;
	for (int i = 1; i < n; i++) 
      if (n % i == 0) {
		int t = 0, alt1 = ((n / i) * (n / i) + 1) / 2 * i * i, alt2 = ((n / i) * (n / i)) / 2 * i * i;
		for (int j = 0; j < k; j++) if (((x1[j] / i) & 1) == ((y1[j] / i) & 1)) t++;
		ans = min(ans, min((alt1 - t) + (tot - t), (alt2 - (tot - t)) + t));
	}
	cout << ans << '\n';
}

Compilation message

cc1plus: error: '::main' must return 'int'
chessboard.cpp: In function 'int main()':
chessboard.cpp:16:3: error: 's' was not declared in this scope
   16 |   s += (x2[i] - x1[i] + 1) * (y2[i] - y1[i] + 1);
      |   ^