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[]) {
pair<int, int> a[256];
int curr = 0;
for (int i = 0; i < 64; i++) {
for (int j = 0; j < 4; j++) {
a[curr++] = make_pair(i, j);
}
}
for(int i = 0; i < n; i++) {
for (int j = 0; j < 4; j++) {
int x = m[i] % 4;
int y = 0;
while (a[y].first != i || a[y].second != j) {
y++;
}
for (int k = 0; k < x; k++) {
send(y);
}
m[i] /= 4;
}
}cerr << endl;
}
#include "decoder.h"
#include "decoderlib.h"
#include <bits/stdc++.h>
using namespace std;
void decode(int N, int L, int X[]) {
pair<int, int> a[256];
int curr = 0;
for (int i = 0; i < 64; i++) {
for (int j = 0; j < 4; j++) {
a[curr++] = make_pair(i, j);
}
}
int pw[4];
pw[0] = 1;
for (int i = 1; i < 4; i++) {
pw[i] = pw[i-1]*4;
}
vector<int> ans(N, 0);
for (int i = 0; i < L; i++) {
int x = X[i];
ans[a[x].first] += pw[a[x].second];
}
for (int i = 0; i < N; i++) {
output(ans[i]);
}
}
# | 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... |