# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
250505 | kostia244 | Parrots (IOI11_parrots) | C++17 | 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> res(n);
map<int, int> cnt;
for(int i = 0; i < l; i++) cnt[X[i]]++;
vector<int> G = {0, 1, 2, 3};
for(auto i : cnt) {
if(i.second >= n) {
i.second -= n;
while(i.second--) next_permutation(G.begin(), G.end());
}
}
//for(auto i : G) cout << i << " "; cout << '\n';
for(int i = 0; i < 255; i++) {
if(i/4 > res.size()) break;
if(cnt[i] >= n) cnt[i] = 0;
res[i/4] += G[cnt[i]]<<(2*(i&3));
}
//for(int i = 0; i < n; i++) cout << res[i] << '\n';
for(int i = 0; i < n; i++) output(res[i]);
}
#include "decoder.h"
#include "decoderlib.h"
#include<bits/stdc++.h>
using namespace std;
void decode(int n, int l, int X[]) {
vector<int> res(n);
map<int, int> cnt;
for(int i = 0; i < l; i++) cnt[X[i]]++;
int rev = 0;
for(auto i : cnt) {
if(i.second >= n) i.second -= n, rev = 255;
res[i.first/4] += i.second<<(2*(i.first&3));
}
for(int i = 0; i < n; i++) output(res[i]^rev);
}