Submission #56852

#TimeUsernameProblemLanguageResultExecution timeMemory
56852qkxwsmParrots (IOI11_parrots)C++17
81 / 100
11 ms2384 KiB
#include "encoder.h"
#include "encoderlib.h"
#include <bits/stdc++.h>

//submit on ojuz!

using namespace std;

#define MP make_pair
#define PB push_back
#define PF push_front
#define LB lower_bound
#define UB upper_bound
#define fi first
#define se second

const long double PI = 4.0 * atan(1.0);
const long double EPS = 1e-10;

#define MAGIC 347
#define SINF 10007
#define CO 1000007
#define INF 1000000007
#define BIG 1000000931
#define LARGE 1696969696967ll
#define GIANT 2564008813937411ll
#define LLINF 2696969696969696969ll

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;


void encode(int N, int arr[])
{
	//last 4 bits are for communicating which one it is, 2 bits for communicating idx, 2 guys left
	vector<int> res;
	//all numbers up to 255
	for (int i = 0; i < N; i++)
	{
		for (int j = 0; j < 8; j++)
		{
			if (arr[i] & (1 << j))
			{
				res.PB(8 * i + j);
			}
		}
	}
	for (int x : res)
	{
		send(x);
	}
}

#include "decoder.h"
#include "decoderlib.h"
#include <bits/stdc++.h>

using namespace std;

#define MP make_pair
#define PB push_back
#define PF push_front
#define LB lower_bound
#define UB upper_bound
#define fi first
#define se second

const long double PI = 4.0 * atan(1.0);
const long double EPS = 1e-10;

#define MAGIC 347
#define SINF 10007
#define CO 1000007
#define INF 1000000007
#define BIG 1000000931
#define LARGE 1696969696967ll
#define GIANT 2564008813937411ll
#define LLINF 2696969696969696969ll

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

void decode(int N, int M, int arr[])
{
	vector<int> ans;
	ans.resize(N);
	for (int i = 0; i < M; i++)
	{
		int x = arr[i];
		int bit = x % 8, idx = x / 8;
		ans[idx] += (1 << bit);
	}
	for (int x : ans)
	{
		output(x);
	}
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...