# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
349988 | idk321 | Parrots (IOI11_parrots) | C++11 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "decoder.h"
#include "decoderlib.h"
#include <bits/stdc++.h>
using namespace std;
void decode(int n, int l, int x[])
{
vector<int> freq(256);
vector<int> res(n, -1);
for (int i = 0; i < l; i++)
{
freq[x[i]]++;
}
vector<int> v;
vector<int> ind;
for (int i = 0; i < 256; i++)
{
for (int j = 0; j < freq[i] / 2; j++)v.push_back(i);
if (freq[i] % 2 == 1) ind.push_back(i % 16);
}
sort(v.begin(), v.end());
for (int i = 0; i < n - 1; i++)
{
//cout << ind[i] << endl;
res[ind[i]] = v[i];
}
for (int i = 0; i < n; i++)
{
if (res[i] == -1) res[i] = v[n - 1];
}
for (int i : res) output(i);
}