Submission #1334585

#TimeUsernameProblemLanguageResultExecution timeMemory
1334585qilbyParrots (IOI11_parrots)C++20
Compilation error
0 ms0 KiB
void encode(int n, int a[]) {
    int c[n];
    vector < int > b;
    for (int i = 0; i < n; i++) b.push_back(a[i]);

    sort(b.begin(), b.end());
    b.resize(unique(b.begin(), b.end()) - b.begin());

    for (int i = 0; i < n; i++) c[i] = lower_bound(b.begin(), b.end(), a[i]) - b.begin();

    for (int i = 0; i < n; i++) {
        send(a[i]);
        send(a[i]);
        send(a[i]);
        send(a[i]);
    }

    int sl = 0, sh = 0;

    for (int i = 0; i < n; i++) {
        sl += (c[i] % 8) + 1;
        send(sl - 1);
        send(sl - 1);
        sh += (c[i] / 8) + 1;
        send(sh - 1);
    }
}
void decode(int n, int m, int a[]) {
    sort(a, a + m);
    vector < int > v, l, h;
    int i = 0, sl = 0, sh = 0;

    while (i < m) {
        int k = 1;
        while (i + 1 < m && a[i + 1] == a[i]) i++, k++;

        if (k & 4) v.push_back(a[i]);

        int w = a[i] + 1;
        if (k & 2) { l.push_back(w - sl - 1); sl = w; }
        if (k & 1) { h.push_back(w - sh - 1); sh = w; }

        i++;
    }

    for (int i = 0; i < n; i++) output(v[l[i] + h[i] * 8]);
}

Compilation message (stderr)

# 1번째 컴파일 단계

encoder.cpp: In function 'void encode(int, int*)':
encoder.cpp:3:5: error: 'vector' was not declared in this scope
    3 |     vector < int > b;
      |     ^~~~~~
encoder.cpp:3:14: error: expected primary-expression before 'int'
    3 |     vector < int > b;
      |              ^~~
encoder.cpp:4:33: error: 'b' was not declared in this scope
    4 |     for (int i = 0; i < n; i++) b.push_back(a[i]);
      |                                 ^
encoder.cpp:6:10: error: 'b' was not declared in this scope
    6 |     sort(b.begin(), b.end());
      |          ^
encoder.cpp:6:5: error: 'sort' was not declared in this scope; did you mean 'short'?
    6 |     sort(b.begin(), b.end());
      |     ^~~~
      |     short
encoder.cpp:7:14: error: 'unique' was not declared in this scope
    7 |     b.resize(unique(b.begin(), b.end()) - b.begin());
      |              ^~~~~~
encoder.cpp:9:40: error: 'lower_bound' was not declared in this scope
    9 |     for (int i = 0; i < n; i++) c[i] = lower_bound(b.begin(), b.end(), a[i]) - b.begin();
      |                                        ^~~~~~~~~~~
encoder.cpp:12:9: error: 'send' was not declared in this scope
   12 |         send(a[i]);
      |         ^~~~
encoder.cpp:22:9: error: 'send' was not declared in this scope
   22 |         send(sl - 1);
      |         ^~~~