# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
596008 | snasibov05 | Parrots (IOI11_parrots) | C++14 | 8 ms | 1220 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 "encoder.h"
#include "encoderlib.h"
void encode(int n, int m[]){
const int nn = 32;
int mx = 8;
int cntz = 0, cnto = 0;
for (int i = 0; i < n; ++i){
for (int j = 0; j < mx; ++j){
if ((1 << j) & m[i]) cnto++;
else cntz++;
}
}
if (cnto <= cntz) {
for (int i = 0; i < n; ++i){
for (int j = 0; j < mx; ++j){
if (1 << j & m[i]) {
if (i < nn) send(j * nn + i);
else {
send(j * nn + (i - nn));
send(j * nn + (i - nn));
}
}
}
}
} else{
send(0); send(0); send(0); send(0);
for (int i = 0; i < n; ++i){
for (int j = 0; j < mx; ++j){
if (!(1 << j & m[i])) {
if (i < nn) send(j * nn + i);
else {
send(j * nn + (i - nn));
send(j * nn + (i - nn));
}
}
}
}
}
}
#include "decoder.h"
#include "decoderlib.h"
#include "bits/stdc++.h"
using namespace std;
void decode(int n, int l, int x[]){
const int nn = 32;
map<int, int> cnt;
for (int i = 0; i < l; ++i) cnt[x[i]]++;
bool flag = cnt[0] > 3;
if (flag) cnt[0] -= 4;
vector<int> v(n);
for (auto [cur, c] : cnt){
if (c == 1 || c == 3) v[cur % nn] += (1 << (cur / nn));
if (c == 2 || c == 3) v[cur % nn + nn] += (1 << (cur / nn));
}
if (flag) {
for (int i = 0; i < n; ++i){
v[i] = 255 - v[i];
}
}
for (int i = 0; i < n; ++i) output(v[i]);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |