제출 #223983

#제출 시각아이디문제언어결과실행 시간메모리
223983Kenzo_1114Parrots (IOI11_parrots)C++17
52 / 100
12 ms1536 KiB
#include<bits/stdc++.h>
#include "encoder.h"
#include "encoderlib.h"
using namespace std;

void encode(int n, int m[])
{
	for(int i = 0; i < min(n, 31); i++)
	{
		for(int k = 7; k >= 0; k--)
			if(m[i] & (1 << k))	send(k + 8 * i);
	}

	for(int i = 32; i < n; i++)
	{
		for(int k = 7; k >= 0; k--)
		{
			send(k + 8 * (i - 32)), send(k + 8 * (i - 32));
			if(m[i] & (1 << k))
				send(k + 8 * (i - 32)), send(k + 8 * (i - 32));
		}
	}
}
#include<bits/stdc++.h>
#include "decoder.h"
#include "decoderlib.h"
using namespace std;

void decode(int n, int l, int x[])
{
	int ans[70], qtt[260];
	for(int i = 0; i < n; i++)	ans[i] = 0;
	for(int i = 0; i < 260; i++)qtt[i] = 0;

	set<int> s;
	set<int> :: iterator it;
	for(int i = 0; i < l; i++)	qtt[x[i]]++, s.insert(x[i]);	

	for(it = s.begin(); it != s.end(); it++)
	{
		if(qtt[(*it)] == 1)	ans[(*it) / 8] += (1 << ((*it) % 8));
		if(qtt[(*it)] == 4)	ans[(*it) / 8 + 32] += (1 << ((*it) % 8));
		if(qtt[(*it)] == 3)	ans[(*it) / 8] += (1 << ((*it) % 8));
		if(qtt[(*it)] == 5)
		{
			ans[(*it) / 8] += (1 << ((*it) % 8));
			ans[(*it) / 8 + 32] += (1 << ((*it) % 8));
		}
	}

	for(int i = 0; i < n; i++)	output(ans[i]);
}
#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...