답안 #855843

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
855843 2023-10-02T03:10:35 Z Trisanu_Das Chessboard (IZhO18_chessboard) C++17
컴파일 오류
0 ms 0 KB
#include <iostream>
#include <algorithm>
#include <climits>
#define int long long
using namespace std;
 
int f(int s, int a) {
	a %= s * 2;
	return min(a, s * 2 - a);
}
 
int main() {
	int n, k, temp, ans;
	cin >> n >> k;
    int x1[n], y1[n], x2[n], y2[n];
	for (i = 0; i < k; i++){
      cin >> x1[i] >> y1[i] >> x2[i] >> y2[i];
      --x1[i]; --y1[i];
    }
	ans = LLONG_MAX;
	for (i = 1; i < n; i++)
		if (n % i == 0) {
			k = (n / i) * (n / i) / 2 * i * i;
			for (i = 0; i < n; i++) temp += (f(i, x2[i]) - f(i, x1[i])) * (f(i, y2[i]) - f(i, y1[i]));
			ans = min(ans, min(temp, n * n - temp));
		}
	cout << ans << '\n';
}

Compilation message

cc1plus: error: '::main' must return 'int'
chessboard.cpp: In function 'int main()':
chessboard.cpp:16:7: error: 'i' was not declared in this scope
   16 |  for (i = 0; i < k; i++){
      |       ^
chessboard.cpp:21:7: error: 'i' was not declared in this scope
   21 |  for (i = 1; i < n; i++)
      |       ^