답안 #205197

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
205197 2020-02-28T09:42:51 Z stefdasca 저장 (Saveit) (IOI10_saveit) C++14
컴파일 오류
0 ms 0 KB
#include<bits/stdc++.h>
#include "grader.h"
#include "encoder.h"

using namespace std;

vector<int> v[1002];

int dist[40][1002], tt[40][1002], state[1002];
void encode(int n, int h, int m, int *a, int *b)
{
    for(int i = 0; i < m; ++i)
    {
        v[a[i]].push_back(b[i]);
        v[b[i]].push_back(a[i]);
    }
    for(int i = 0; i < h; ++i)
    {
        dist[i][i] = 1;
        deque<int> d;
        while(!d.empty())
        {
            int nod = d[0];
            d.pop_front();
            for(int x = 0; x < v[nod].size(); ++x)
            {
                int vecin = v[nod][x];
                if(!dist[i][vecin])
                {
                    dist[i][vecin] = dist[i][nod] + 1;
                    tt[i][vecin] = nod;
                    d.push_back(vecin);
                }
            }
        }
        if(i == 0)
            for(int j = 1; j < n; ++j)
                for(int x = 0; x < 10; ++x)
                    encode_bit((tt[0][j] & (1<<x)) != 0);
        for(int j = 0; j < n; ++j)
        {
            if(dist[i][j] == dist[i][tt[0][j]])
                state[j] = 0;
            else
                if(dist[i][j] > dist[i][tt[0][j]])
                    state[j] = 1;
                else
                    state[j] = 2;
        }
        // 5 states with 8 bits
        for(int j = 0; j < n; j += 5)
        {
            int msk = 0;
            for(int x = j; x < min(n, j + 5); ++x)
                msk = msk * 3 + state[x];
            for(int pw = 0; pw <= 7; ++pw)
                encode_bit((msk & (1<<pw)) != 0);
        }
    }
}




    

Compilation message

encoder.cpp: In function 'void encode(int, int, int, int*, int*)':
encoder.cpp:25:30: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for(int x = 0; x < v[nod].size(); ++x)
                            ~~^~~~~~~~~~~~~~~

/tmp/ccNYTiJV.o: In function `main':
grader_decoder.c:(.text.startup+0xe6): undefined reference to `decode(int, int)'
collect2: error: ld returned 1 exit status