QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#334367#4325. Kraljicelukap_Compile Error//C++232.9kb2024-02-21 20:05:572024-02-21 20:05:58

Judging History

你现在查看的是最新测评结果

  • [2024-02-21 20:05:58]
  • 评测
  • [2024-02-21 20:05:57]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define fi first
#define se second
#define pii pair<int, int>

const int MAX = 2e3 + 10;
int n;
int mat[MAX][MAX];
int smjer[8][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}, {1, 1}, {1, -1}, {-1, 1}, {-1, -1}};
vector <pii> v = {{1, 2}, {2, 4}, {1, 3}, {2, 1}, {2, 2}, {3, 4}, {1, 4}, {3, 1}, {3, 2}, {3, 3}, {4, 1}, {4, 3}, {4, 2}, {4, 4}};
vector <pii> v2 = {{2, 3}, {3, 1}, {2, 2}, {1, 1}, {3, 3}, {3, 2}, {1, 2}, {1, 3}, {2, 1}};
vector <pii> par = {{0, 2}, {0, 1}, {1, 2}, {1, 0}, {2, 0}, {1, 1}, {2, 1}, {2, 2}};
vector <pii> nep = {{1, 2}, {0, 1}, {2, 1}, {1, 1}, {0, 2}, {2, 0}, {1, 0}, {2, 2}};

bool moguce(int x, int y) {
    int cnt = 0;

    for (int i = 0; i < 8; i++) {
        int x2 = x;
        int y2 = y;

        while (x2 >= 1 && x2 <= n && y2 >= 1 && y2 <= n) {
            if (mat[x2][y2]) cnt++;

            x2 += smjer[i][0];
            y2 += smjer[i][1];
        }
    }

    if (cnt % 2 == 0) return true;
    return false;
}

int main() {
    cin >> n;

    if (n <= 2) {
        cout << "1\n1 1\n";
        return 0;
    }

    if (n % 2 == 0) {
        cout << n * n - 2 << "\n";

        for (int i = 0; i < 14; i++) {
            cout << v[i].fi << " " <<  v[i].se << "\n";
            mat[v[i].fi][v[i].se] = 1;
        }
    }
    else {
        cout << n * n << "\n";

        for (int i = 0; i < 9; i++) {
            cout << v2[i].fi << " " <<  v2[i].se << "\n";
            mat[v2[i].fi][v2[i].se] = 1;
        }
    }

    int bla = 4;
    if (n % 2 == 0) bla = 5;
    for (int i = bla; i <= n; i += 2) {
        for (int j = 1; j <= i - 2; j++) {
            if (moguce(i, j)) {
                cout << i << " " << j << "\n";
                cout << i + 1 << " " << j << "\n";
            }
            else {
                cout << i + 1 << " " << j << "\n";
                cout << i << " " << j << "\n";
            }

            mat[i][j] = 1;
            mat[i + 1][j] = 1;

            if (moguce(j, i)) {
                cout << j << " " << i << "\n";
                cout << j << " " << i + 1 << "\n";
            }
            else {
                cout << j << " " << i + 1 << "\n";
                cout << j << " " << i << "\n";
            }

            mat[j][i] = 1;
            mat[j][i + 1] = 1;
        }

        if (n % 2 == 0) {
            for (auto e : par) {
                int x = e.fi + i - 1;
                int y = e.se + i - 1;

                mat[x][y] = 1;
                cout << x << " " << y << "\n";
            }
        }
        else {
            for (auto e : nep) {
                int x = e.fi + i - 1;
                int y = e.se + i - 1;

                mat[x][y] = 1;
                cout << x << " " << y << "\n";
            }
        }
    }

    return 0;
}

Details

answer.code:112:1: error: extended character   is not valid in an identifier
  112 |     return 0;
      | ^
answer.code:112:1: error: extended character   is not valid in an identifier
answer.code:112:1: error: extended character   is not valid in an identifier
answer.code:112:1: error: extended character   is not valid in an identifier
answer.code:112:1: error: extended character   is not valid in an identifier
answer.code: In function ‘int main()’:
answer.code:112:1: error: ‘    return 0’ was not declared in this scope
  112 |     return 0;
      | ^~~~~~~~~~~~