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;
vector <int> mp[300];
void encode(int n, int m[]) {
int ct = 0;
for (int i1 = 0; i1 <= 4 && ct < 256; i1++)
for (int i2 = i1; i2 <= 4 && ct < 256; i2++)
for (int i3 = i2; i3 <= 4 && ct < 256; i3++)
for (int i4 = i3; i4 <= 4 && ct < 256; i4++)
for (int i5 = i4; i5 <= 4 && ct < 256; i5++)
for (int i6 = i5; i6 <= 4 && ct < 256; i6++)
for (int i7 = i6; i7 <= 4 && ct < 256; i7++){
vector <int> x = {i1, i2, i3, i4, i5, i6, i7};
mp[ct++] = x;
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < 7; j++){
int v = i << 2;
if (mp[m[i]][j] != 0) {
v+=mp[m[i]][j] - 1;
send(v);
}
}
}
}
#include <bits/stdc++.h>
#include "decoder.h"
#include "decoderlib.h"
using namespace std;
vector <int> v[300];
map <vector <int>, int> revmp;
void decode(int n, int l, int x[]) {
int ct = 0;
for (int i1 = 0; i1 <= 4 && ct < 256; i1++)
for (int i2 = i1; i2 <= 4 && ct < 256; i2++)
for (int i3 = i2; i3 <= 4 && ct < 256; i3++)
for (int i4 = i3; i4 <= 4 && ct < 256; i4++)
for (int i5 = i4; i5 <= 4 && ct < 256; i5++)
for (int i6 = i5; i6 <= 4 && ct < 256; i6++)
for (int i7 = i6; i7 <= 4 && ct < 256; i7++){
vector <int> x = {i1, i2, i3, i4, i5, i6, i7};
revmp[x] = ct++;
}
for (int i = 0; i < n; i++){
v[i].clear();
}
for (int i = 0; i < l; i++){
int idx = x[i] >> 2;
v[idx].push_back((x[i] & 3) + 1);
}
for (int i = 0; i < n; i++){
while (v[i].size() != 7) v[i].push_back(0);
sort(v[i].begin(), v[i].end());
output(revmp[v[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... |