# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
233473 | crossing0ver | Parrots (IOI11_parrots) | C++17 | 22 ms | 1792 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<bits/stdc++.h>
#include "encoder.h"
#include "encoderlib.h"
using namespace std;
void encode(int N, int M[])
{
int i,val;
vector<int> S(256);
for(i=0; i<N; i++) {
send(M[i]);
send(M[i]);
send(M[i]);
send(M[i]);
int t = S[M[i]];
val = i*4;
for (int j = 0; j < N; j++)
if (M[j] < M[i]) t++;
S[M[i]]++;
if (t >= 32) send(val + 3),t-=32;
while (t >= 8) send(val + 2), t-=8;
while (t >= 2) send(val + 1), t-=2;
if (t) send(val);
}
}
#include<bits/stdc++.h>
#include "decoder.h"
#include "decoderlib.h"
using namespace std;
void decode(int N, int L, int X[])
{
int i, b , pos;
vector<int> v(10);
vector<int> set;
vector<int> S(256);
vector<int> ans(N);
for(i=0; i<L; i++) {
b = X[i];
S[b]++;
}
for (int i = 0; i < 256; i++) {
if (S[i] >= 4) {
for (int j = 0; j < S[i]/4; j++)
set.push_back(i);
S[i] %= 4;
}
while (S[i]) {
S[i]--;
int pos = i/4;
if (i%4 == 0) {
ans[pos] += (1);
}
else if (i % 4 == 1) ans[pos]+=2;
else if (i%4 == 2) ans[pos] += 8;
else if (i%4 == 3) ans[pos] += 32;
}
}
sort(set.begin(),set.end());
for (int i = 0; i < N; i++)
output(set[ans[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... |