Submission #888697

# Submission time Handle Problem Language Result Execution time Memory
888697 2023-12-18T05:47:54 Z Muhammad_Aneeq Saveit (IOI10_saveit) C++17
Compilation error
0 ms 0 KB
void qu(int x)
{
	for (int i=0;i<=11;i++)
	{
		if ((1<<i)&x)
			encode_bit(1);
		else
			encode_bit(0);
	}
}
void encode(int N,int H,int P,int v1[1234567],int v2[1234567])
{
	for (int i=0;i<P;i++)
	{
		int a=v1[i],b=v2[i];
		qu(a);qu(b);
	}
	for (int i=0;i<=11;i++)
		encode_bit(1);
}
#include <map>
#include <vector>
#include <set>
#include <cmath>
using namespace std;
int const MAXN=1000+10;
vector<int>nei[MAXN]={};
int dis[MAXN]={};
void bfs(int x)
{
	dis[x]=0;
	set<pair<int,int>>s;
	s.insert({0,x});
	while (s.size())
	{
		int z=(*begin(s)).second;
		s.erase(*begin(s));
		for (auto i:nei[z])
		{
			if (dis[i]>dis[z]+1)
			{
				s.erase({dis[i],i});
				dis[i]=dis[z]+1;
				s.insert({dis[i],i});
			}
		}
	}
}

int q()
{
	int ans=0;
	for (int i=0;i<=11;i++)
	{
		if (decode_bit())
			ans+=(1<<i);
	}
	return ans;
}
void decode(int N,int H)
{
	while (1)
	{
		int an=q();
		if (an==4095)
			break;
		int o=q();
		nei[an].push_back(o);
		nei[o].push_back(an);
	}
	for (int i=0;i<H;i++)
	{
		for (int j=0;j<N;j++)
			dis[j]=1e4;
		bfs(i);
		for (int j=0;j<N;j++)
			hops(i,j,dis[j]);
	}
}

Compilation message

encoder.cpp: In function 'void qu(int)':
encoder.cpp:6:4: error: 'encode_bit' was not declared in this scope
    6 |    encode_bit(1);
      |    ^~~~~~~~~~
encoder.cpp:8:4: error: 'encode_bit' was not declared in this scope
    8 |    encode_bit(0);
      |    ^~~~~~~~~~
encoder.cpp: In function 'void encode(int, int, int, int*, int*)':
encoder.cpp:19:3: error: 'encode_bit' was not declared in this scope; did you mean 'encode'?
   19 |   encode_bit(1);
      |   ^~~~~~~~~~
      |   encode

decoder.cpp: In function 'int q()':
decoder.cpp:35:7: error: 'decode_bit' was not declared in this scope
   35 |   if (decode_bit())
      |       ^~~~~~~~~~
decoder.cpp: In function 'void decode(int, int)':
decoder.cpp:57:4: error: 'hops' was not declared in this scope
   57 |    hops(i,j,dis[j]);
      |    ^~~~