제출 #767163

#제출 시각아이디문제언어결과실행 시간메모리
767163raysh07앵무새 (IOI11_parrots)C++17
컴파일 에러
0 ms0 KiB
#include "encoder.h"
#include "encoderlib.h"
#include <bits/stdc++.h>
using namespace std;
int ok = 0;

void encode(int n, int a[])
{
    ok++;
    assert(ok <= 1);
//   int i;
//   for(i=0; i<N; i++)
//     send(M[i]);
    if (n < 16){
        for (int i = 0; i < n; i++){
            for (int j = 0; j < 8; j++){
                if (a[i] >> j & 1){
                    send(8 * i + j);
                }
            }
        }
        return;
    }
    
    vector <int> b;
    vector <pair<int, int>> f(4);
    for (int i = 0; i < 4; i++){
        f[i] = {0, i};
    }
    for (int i = 0; i < n; i++){
        int copy = a[i];
        for (int j = 0; j < 4; j++){
            b.push_back(copy % 4);
            copy /= 4;
            f[b.back()].first++;
        }
    }
    
    sort(f.begin(), f.end());
    map <int, int> mp;
    for (int i = 0; i < 4; i++){
        mp[f[i].second] = 3 - i;
        //send f[i].second 3 - i times
        for (int j = 0; j < 4 * (3 - i); j++) send(f[i].second);
    }
    
    int val = 0;
    
    for (auto x : b){
        int y = mp[x];
        for (int i = 0; i < y; i++) send(val);
        val++;
    }
}

컴파일 시 표준 에러 (stderr) 메시지

/usr/bin/ld: /tmp/ccsCo74f.o: in function `main':
grader_decoder.cpp:(.text.startup+0x1ef): undefined reference to `decode(int, int, int*)'
collect2: error: ld returned 1 exit status