Submission #595243

# Submission time Handle Problem Language Result Execution time Memory
595243 2022-07-13T13:11:32 Z alextodoran Treasure (different grader from official contest) (CEOI13_treasure2) C++17
Compilation error
0 ms 0 KB
/**
 ____ ____ ____ ____ ____
||a |||t |||o |||d |||o ||
||__|||__|||__|||__|||__||
|/__\|/__\|/__\|/__\|/__\|

**/

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int N_MAX = 100;

int N;

bool found[N_MAX + 2][N_MAX + 2];

int ask (int i1, int j1, int i2, int j2) {
    cout << i1 << " " << j1 << " " << i2 << " " << j2 << endl;
    int answer;
    cin >> answer;
    return answer;
}

int UL[N_MAX + 2][N_MAX + 2];
int UR[N_MAX + 2][N_MAX + 2];
int DL[N_MAX + 2][N_MAX + 2];
int DR[N_MAX + 2][N_MAX + 2];

void precalc () {
    // Compute sum of cheaper corner
    for (int i = 1; i <= N / 2; i++) {
        for (int j = 1; j <= N / 2; j++) {
            DR[i][j] = ask(i, j, N, N);
        }
    }
    for (int i = 1; i <= N / 2; i++) {
        for (int j = N / 2; j < N; j++) {
            DL[i][j] = ask(i, 1, N, j);
        }
    }
    for (int i = 1; i <= N / 2; i++) {
        DL[i][N] = DR[i][1];
    }
    for (int i = N / 2; i < N; i++) {
        for (int j = 1; j <= N / 2; j++) {
            UR[i][j] = ask(1, j, i, N);
        }
    }
    for (int j = 1; j <= N / 2; j++) {
        UR[N][j] = DR[1][j];
    }
    for (int i = N / 2; i < N; i++) {
        for (int j = N / 2; j < N; j++) {
            UL[i][j] = ask(1, 1, i, j);
        }
    }
    for (int i = N / 2; i <= N; i++) {
        UL[i][N] = UR[i][1];
    }
    for (int j = N / 2; j <= N; j++) {
        UL[N][j] = DL[1][j];
    }
    // Compute sum of upper-left corner
    for (int i = 1; i <= N / 2 - 1; i++) {
        for (int j = N / 2; j <= N; j++) {
            UL[i][j] = DL[1][j] - DL[i + 1][j];
        }
    }
    for (int i = N / 2; i <= N; i++) {
        for (int j = 1; j <= N / 2 - 1; j++) {
            UL[i][j] = UR[i][1] - UR[i][j + 1];
        }
    }
    for (int i = 1; i <= N / 2 - 1; i++) {
        for (int j = 1; j <= N / 2 - 1; j++) {
            UL[i][j] = UL[i][N] + UL[N][j] + DR[i + 1][j + 1] - DR[1][1];
        }
    }
}

void solve () {
    for (int i = 1; i <= N; i++) {
        for (int j = 1; j <= N; j++) {
            found[i][j] = UL[i][j] - UL[i - 1][j] - UL[i][j - 1] + UL[i - 1][j - 1];
        }
    }
}

int main () {
    cin >> N;

    precalc();
    solve();

    cout << "END" << endl;
    for (int i = 1; i <= N; i++) {
        for (int j = 1; j <= N; j++) {
            cout << found[i][j];
        }
        cout << endl;
    }

    return 0;
}

Compilation message

/usr/bin/ld: /tmp/cc6Xzorp.o: in function `main':
treasure.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccz7HTfr.o:grader.c:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccz7HTfr.o: in function `main':
grader.c:(.text.startup+0x103): undefined reference to `findTreasure(int)'
collect2: error: ld returned 1 exit status