Submission #252843

# Submission time Handle Problem Language Result Execution time Memory
252843 2020-07-26T10:46:05 Z SamAnd Saveit (IOI10_saveit) C++17
Compilation error
0 ms 0 KB
#include "grader.h"
//#include "encoder.h"
//#include "decoder.h"
#include <vector>
#include <algorithm>
#include <cstdio>
#include <map>
#include <set>
#include <queue>
using namespace std;
const int N = 1002;

int nn, m, u;
vector<int> a[N];
int d[N];
bool c[N];
void bfs(int x)
{
	for (int i = 0; i < nn; ++i)
	{
		c[i] = false;
		d[i] = 0;
	}
	queue<int> q;
	c[x] = true;
	q.push(x);
	while (!q.empty())
	{
		int x = q.front();
		q.pop();
		for (int i = 0; i < a[x].size(); ++i)
		{
			int h = a[x][i];
			if (!c[h])
			{
				c[h] = true;
				d[h] = d[x] + 1;
				q.push(h);
			}
		}
	}
}
void funkc()
{
	encode_bit(1);
	encode_bit(1);
	encode_bit(1);
	encode_bit(1);
	encode_bit(1);
	encode_bit(1);
	encode_bit(1);
	encode_bit(1);
	encode_bit(1);
	encode_bit(1);
}
void encode(int nv, int nh, int ne, int *v1, int *v2) {
	nn = nv;
	u = nh;
	m = ne;
	for (int i = 0; i < m; ++i)
	{
		a[v1[i]].push_back(v2[i]);
		a[v2[i]].push_back(v1[i]);
	}
	for (int i = 0; i < u; ++i)
	{
		bfs(i);
		for (int j = 0; j < nn; ++j)
		{
			vector<int> v;
			if (!d[j])
			{
				for (int k = 0; k<9; ++k)
					encode_bit(0);
				encode_bit(0);
				continue;
			}
			while (d[j])
			{
				v.push_back((d[j] % 2));
				d[j] /= 2;
			}
			for (int k = 0; k < (10 - v.size()); ++k)
			{
				encode_bit(0);
			}
			for (int k = v.size() - 1; k >= 0; --k)
			{
				encode_bit(v[k]);
			}
		}
	}
	return;
}
void decode(int nv, int nh) {
	int v = 0;
	int u = 0;
	int n = 0;
	int i = 0;
	while (1)
	{
		++i;
		n *= 2;
		n += decode_bit();
		if (i % 10 == 0)
		{
			hops(v, u, n);
			++u;
			if (u == nv)
			{
				++v;
				u = 0;
			}
			if (v == nh)
			{
				break;
			}
			n = 0;
		}
	}
}



    

Compilation message

encoder.cpp: In function 'void bfs(int)':
encoder.cpp:31:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int i = 0; i < a[x].size(); ++i)
                   ~~^~~~~~~~~~~~~
encoder.cpp: In function 'void encode(int, int, int, int*, int*)':
encoder.cpp:83:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for (int k = 0; k < (10 - v.size()); ++k)
                    ~~^~~~~~~~~~~~~~~~~
/tmp/ccYGgygh.o: In function `decode(int, int)':
encoder.cpp:(.text+0xc7): undefined reference to `decode_bit()'
encoder.cpp:(.text+0xd8): undefined reference to `decode_bit()'
encoder.cpp:(.text+0xfe): undefined reference to `hops(int, int, int)'
collect2: error: ld returned 1 exit status

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