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"
#include<bits/stdc++.h>
using namespace std;
void encode(int N, int M[]) {
int c = 0, t = 0;
vector< int > v[5];
int P[500] = {0};
int cc[500] = {0};
for(int i=0; i<N; i++) {
int tt = M[i];
for(int j = 0; j < 8; j+=2) {
P[c] = (tt) & 3;
cc[P[c]]++;
c++;
tt >>= 2;
}
}
int mx = max(max(cc[0], cc[1]), max(cc[2], cc[3]));
if(mx == cc[0]) { t = 0; send(0); send(0); send(0); send(0); }
else/* if(mx == cc[1]) */{ t = 1; send(1); send(1); send(1); send(1); }
/*else if(mx == cc[2]) { t = 2; send(2); send(2); send(2); send(2); }
else if(mx == cc[3]) { t = 3; send(3); send(3); send(3); send(3); }
*/
for(int i = 0; i < c; i++) {
if(P[i] == t) P[i] = 0;
if(P[i] < t) P[i]++;
while(P[i]--) {
send(i);
}
}
}
#include "decoder.h"
#include "decoderlib.h"
#include<bits/stdc++.h>
using namespace std;
void decode(int N, int L, int X[]) {
int cc[500] = {0}, t = 0;
for(int i=0; i<L; i++) cc[X[i]]++;
if(0 || cc[0] > 3) { cc[0] -= 4; t = 0;}
else /*if(cc[1] > 3) */{ cc[1] -= 4; t = 1;}
// else if(cc[2] > 3) { cc[2] -= 4; t = 2;}
// else if(cc[3] > 3) { cc[3] -= 4; t = 3;}
for(int i = 0; i < N * 4; i++) {
if(cc[i] == 0) cc[i] = t;
else if(cc[i] <= t) cc[i]--;
if(i % 4 == 3) {
int t = 64 * cc[i] + 16 * cc[i-1] + 4 * cc[i-2] + cc[i-3];
output(t);
}
}
}
# | 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... |