Submission #90128

# Submission time Handle Problem Language Result Execution time Memory
90128 2018-12-20T13:27:00 Z adlet Chessboard (IZhO18_chessboard) C++17
Compilation error
0 ms 0 KB
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>

#define file(s) if (fopen(s".in", "r")) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout)

using namespace std;

typedef long long ll;

#define int ll

const int N = 1e5 + 5;
const ll INF = 1e18;
const int mod = 1e9 + 7;
const double PI = acos(-1.0);

int n, k;

ll ans = INF;

vector < int > v;

int get(int x1, int y1, int d) {
    x1 /= d;
    y1 /= d;
    return ((x1 % 2) == (y1 % 2));
}
int x[N], y[N];

int main() {
    cin >> n >> k;
    for (int i = 1; i <= k; ++i) {
        int x2, y2;
        cin >> x[i] >> y[i] >> x2 >> y2;
    }
    v.push_back(1);
    for (int i = 2; i * i <= n; ++i) {
        if (n % i == 0) {
            v.push_back(i);
            if (n / i != i) {
                v.push_back(n / i);
            }
        }
    }
    for (int i : v) {
        int m = n / i, cnt_black = 0, cnt_white = 0;
        ll black = (((m * m) / 2) + (m * m) % 2) * (i * 1ll * i);
        ll white = (n * 1ll * n) - black;
        for (int j = 1; j <= k; ++j) {
            cnt_black += get(x[j] - 1, y[j] - 1, i);
        }
        cnt_white = k - cnt_black;
        ll x = (black - cnt_black) + cnt_white;
        ll y = (white - cnt_white) + cnt_black;
        ans = min(ans, min(x, y));
    }
    cout << ans;
}

Compilation message

chessboard.cpp:30:10: error: '::main' must return 'int'
 int main() {
          ^