Submission #17091

#TimeUsernameProblemLanguageResultExecution timeMemory
17091erdemkirazParrots (IOI11_parrots)C++98
81 / 100
7 ms2320 KiB
#include "encoder.h"
#include "encoderlib.h"

#include <bits/stdc++.h>

using namespace std;

#define type(x) __typeof((x).begin())
#define foreach(it, x) for(type(x) it = (x).begin(); it != (x).end(); it++)
typedef long long ll;
typedef pair < int, int > ii;

const int inf = 1e9 + 333;
const ll linf = 1e18 + inf;

const int N = 100 + 5;

int pw[6];

void encode(int n, int a[]) {
	pw[0] = 1;
	for(int i = 1; i < 6; i++)
		pw[i] = pw[i - 1] * 3;
	for(int i = 0; i < n; i++) {
		for(int p = 5; p >= 0; p--) {
			while(a[i] >= pw[p]) {
				send(p + i * 6);
				a[i] -= pw[p];
			}
		}
	}
}
#include "decoder.h"
#include "decoderlib.h"

#include <bits/stdc++.h>

using namespace std;

#define type(x) __typeof((x).begin())
#define foreach(it, x) for(type(x) it = (x).begin(); it != (x).end(); it++)
typedef long long ll;
typedef pair < int, int > ii;

const int inf = 1e9 + 333;
const ll linf = 1e18 + inf;

const int N = 100 + 5;

static int pw[6];
int ans[N];

void decode(int n, int m, int a[]) {
	memset(ans, 0, sizeof(ans));
	pw[0] = 1;
	for(int i = 1; i < 6; i++)
		pw[i] = pw[i - 1] * 3;
	sort(a, a + m);
	for(int i = 0; i < m; i++) {
		ans[a[i] / 6] += pw[a[i] % 6];
	}
	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...