Submission #405195

# Submission time Handle Problem Language Result Execution time Memory
405195 2021-05-15T20:51:58 Z Jasiekstrz Saveit (IOI10_saveit) C++17
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
#include "grader.h"
#include "decoder.h"
#define fi first
#define se second
using namespace std;
static const int N=1e3;
static vector<pair<int,long long>> e[N+10];
int receive_int()
{
	int ans=0;
	for(int i=0;i<10;i++)
		ans=(2*ans+decode_bit());
	return ans;
}
long long receive_weight()
{
	long long ans=0;
	for(int i=0;i<58;i++)
		ans=(2*ans+decode_bit());
	return ans;
}
long long reverse_weight(long long w,int h)
{
	long long tmp=0;
	for(int i=0;i<h;i++,w/=3)
		tmp=3*tmp+2-w%3;
	for(int i=0;i<h;i++,tmp/=3)
		w=3*w+tmp%3;
	return w;
}
static void dfs(int x,int h)
{
	while(!decode_bit())
	{
		int y=receive_int();
		long long w=receive_weight();
		//cerr<<x<<" "<<y<<" "<<w<<"\n";
		e[x].emplace_back(y,w);
		e[y].emplace_back(x,reverse_weight(w,h));
		dfs(y,h);
	}
	return;
}
static void dfs_ans(int x,int p,int h,int dd)
{
	//cerr<<h<<" "<<x<<" "<<dd<<"\n";
	hops(h,x,dd);
	//cerr<<"ok\n";
	for(auto &v:e[x])
	{
		//cerr<<x<<"("<<p<<")"<<" "<<v.fi<<" "<<v.se<<"\n";
		if(v.fi!=p)
		{
			//cerr<<"ok\n";
			dfs_ans(v.fi,x,h,dd+v.se%3-1);
			//cerr<<"ok2\n";
		}
		v.se/=3;
	}
	return;
}
void decode(int nv,int nh)
{
	dfs(0,nh);
	for(int i=0;i<nh;i++)
		dfs_ans(i,-1,i,0);
	return;
}
#include<bits/stdc++.h>
#include "grader.h"
#include "decoder.h"
#define fi first
#define se second
using namespace std;
static const int NN=1e3;
static vector<int> e[NN+10];
static bool vis[NN+10];
int receive_int()
{
	int ans=0;
	for(int i=0;i<10;i++)
		ans=(2*ans+decode_bit());
	return ans;
}
static void bfs(int x,int n)
{
	for(int i=0;i<n;i++)
		vis[i]=false;
	queue<pair<int,int>> qq;
	vis[x]=true;
	qq.push({x,0});
	while(!qq.empty())
	{
		auto y=qq.front();
		qq.pop();
		hops(x,y.fi,y.se);
		for(auto v:e[y.fi])
		{
			if(!vis[v])
			{
				vis[v]=true;
				qq.push({v,y.se+1});
			}
		}
	}
	return;
}
void decode(int nv,int nh)
{
	for(int i=0;i<nv;i++)
	{
		int d=receive_int();
		for(int j=0;j<d;j++)
		{
			int b=receive_int();
			e[i].push_back(b);
			e[b].push_back(i);
		}
	}
	for(int i=0;i<nh;i++)
		bfs(i,nv);
	return;
}

Compilation message

/usr/bin/ld: /tmp/ccgbr6fD.o: in function `main':
grader_encoder.c:(.text.startup+0x122): undefined reference to `encode(int, int, int, int*, int*)'
/usr/bin/ld: /tmp/ccLMtKhC.o: in function `dfs_ans(int, int, int, int)':
encoder.cpp:(.text+0x71): undefined reference to `hops(int, int, int)'
/usr/bin/ld: /tmp/ccLMtKhC.o: in function `dfs(int, int)':
encoder.cpp:(.text+0x138): undefined reference to `decode_bit()'
/usr/bin/ld: encoder.cpp:(.text+0x151): undefined reference to `decode_bit()'
/usr/bin/ld: encoder.cpp:(.text+0x171): undefined reference to `decode_bit()'
/usr/bin/ld: encoder.cpp:(.text+0x260): undefined reference to `decode_bit()'
/usr/bin/ld: /tmp/ccLMtKhC.o: in function `receive_int()':
encoder.cpp:(.text+0x50c): undefined reference to `decode_bit()'
/usr/bin/ld: /tmp/ccLMtKhC.o:encoder.cpp:(.text+0x539): more undefined references to `decode_bit()' follow
collect2: error: ld returned 1 exit status