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[]) {
vector<array<int, 4>> H;
for(int Os = 0; Os <= 7; ++Os) {
for(int Is = 0; Is + Os <= 7; ++Is) {
for(int Zs = 0; Zs + Is + Os <= 7; ++Zs) {
for(int Es = 0; Es + Zs + Is + Os <= 7; ++Es) {
H.push_back({Os, Is, Zs, Es});
}
}
}
}
sort(begin(H), end(H));
for(int i = 0; i < N; ++i) {
array<int, 4> k = H[M[i]];
for(int x : {0, 1, 2, 3}) while(k[x]--) send(((i << 2) ^ x));
}
}
#include "decoder.h"
#include "decoderlib.h"
#include <bits/stdc++.h>
using namespace std;
void decode(int N, int L, int X[]) {
int H[8][8][8][8];
memset(H, -1, sizeof(H));
for(int Os = 0, C = 0; Os <= 7; ++Os) {
for(int Is = 0; Is + Os <= 7; ++Is) {
for(int Zs = 0; Zs + Is + Os <= 7; ++Zs) {
for(int Es = 0; Es + Zs + Is + Os <= 7; ++Es) {
H[Os][Is][Zs][Es] = C++;
}
}
}
}
vector<array<int, 4>> cnt(N);
for(int i = 0; i < L; ++i) {
++cnt[(X[i] >> 2)][(X[i] & 3)];
}
for(int i = 0; i < N; ++i) {
output(H[cnt[i][0]][cnt[i][1]][cnt[i][2]][cnt[i][3]]);
}
}
# | 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... |