Submission #518458

#TimeUsernameProblemLanguageResultExecution timeMemory
518458tabrParrots (IOI11_parrots)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;
#ifdef tabr
#include "library/debug.cpp"
#else
#define debug(...)
#endif

#define decoder

#ifdef encoder
#include "encoder.h"
#include "encoderlib.h"

void encode(int n, int a[]) {
    vector<int> b(n * 8);
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < 8; j++) {
            b[i * 8 + j] = (a[i] >> j) & 1;
        }
    }
    for (int i = 0; i < n * 8; i++) {
        if (b[i]) {
            if (i >= 256) {
                send(i - 256);
                send(i - 256);
            } else {
                send(i);
            }
        }
    }
}
#endif

#ifdef decoder
#include "decoder.h"
#include "decoderlib.h"

void decode(int n, int l, int a[]) {
    sort(a, a + l);
    vector<int> b(n * 8);
    vector<int> cnt(256);
    for (int i = 0; i < l; i++) {
        cnt[a[i]]++;
    }
    for (int i = 0; i < 256; i++) {
        if (cnt[i] & 1) {
            b[i] = 1;
        }
        if (cnt[i] & 2) {
            b[i + 256] = 1;
        }
    }
    for (int i = 0; i < n; i++) {
        int c = 0;
        for (int j = 0; j < 8; j++) {
            if (b[i * 8 + j]) {
                c |= 1 << j;
            }
        }
        output(c);
    }
}
#endif

#ifdef tabr
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    return 0;
}
#endif
#include <bits/stdc++.h>
using namespace std;
#ifdef tabr
#include "library/debug.cpp"
#else
#define debug(...)
#endif

#define encoder

#ifdef encoder
#include "encoder.h"
#include "encoderlib.h"

void encode(int n, int a[]) {
    vector<int> b(n * 8);
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < 8; j++) {
            b[i * 8 + j] = (a[i] >> j) & 1;
        }
    }
    for (int i = 0; i < n * 8; i++) {
        if (b[i]) {
            if (i >= 256) {
                send(i - 256);
                send(i - 256);
            } else {
                send(i);
            }
        }
    }
}
#endif

#ifdef decoder
#include "decoder.h"
#include "decoderlib.h"

void decode(int n, int l, int a[]) {
    sort(a, a + l);
    vector<int> b(n * 8);
    vector<int> cnt(256);
    for (int i = 0; i < l; i++) {
        cnt[a[i]]++;
    }
    for (int i = 0; i < 256; i++) {
        if (cnt[i] & 1) {
            b[i] = 1;
        }
        if (cnt[i] & 2) {
            b[i + 256] = 1;
        }
    }
    for (int i = 0; i < n; i++) {
        int c = 0;
        for (int j = 0; j < 8; j++) {
            if (b[i * 8 + j]) {
                c |= 1 << j;
            }
        }
        output(c);
    }
}
#endif

#ifdef tabr
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    return 0;
}
#endif

Compilation message (stderr)

/usr/bin/ld: /tmp/ccA1IH11.o: in function `decode(int, int, int*)':
encoder.cpp:(.text+0x588): undefined reference to `output(int)'
/usr/bin/ld: /tmp/ccWV7jW1.o: in function `main':
grader_encoder.cpp:(.text.startup+0x162): undefined reference to `encode(int, int*)'
collect2: error: ld returned 1 exit status

/usr/bin/ld: /tmp/ccwHl4HN.o: in function `encode(int, int*)':
decoder.cpp:(.text+0xcb): undefined reference to `send(int)'
/usr/bin/ld: decoder.cpp:(.text+0xd3): undefined reference to `send(int)'
/usr/bin/ld: decoder.cpp:(.text+0xf6): undefined reference to `send(int)'
/usr/bin/ld: /tmp/ccLLNUmL.o: in function `main':
grader_decoder.cpp:(.text.startup+0x1ef): undefined reference to `decode(int, int, int*)'
collect2: error: ld returned 1 exit status