이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "encoder.h"
#include "encoderlib.h"
using namespace std;
const int maxn = 64;
const int bits = 8;
const int sg = 7;
const int maxval = 256;
vector <int> mp[maxval];
void encode(int n, int m[]) {
int ct = 0;
for (int i1 = 0; i1 <= 3 && ct < maxval; i1++)
for (int i2 = i1; i2 <= 3 && ct < maxval; i2++)
for (int i3 = i2; i3 <= 3 && ct < maxval; i3++)
for (int i4 = i3; i4 <= 3 && ct < maxval; i4++)
for (int i5 = i4; i5 <= 3 && ct < maxval; i5++)
for (int i6 = i5; i6 <= 3 && ct < maxval; i6++)
for (int i7 = i6; i7 <= 3 && ct < maxval; i7++){
vector <int> v = {i1, i2, i3, i4, i5, i6, i7};
mp[ct++] = v;
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < 7; j++){
int v = i << 2;
v+=mp[m[i]][j];
send(v);
}
}
}
#include <bits/stdc++.h>
#include "decoder.h"
#include "decoderlib.h"
using namespace std;
const int maxn = 64;
const int bits = 8;
const int sg = 7;
const int maxval = 256;
vector <int> v[maxn + 1];
map <vector <int>, int> revmp;
void decode(int n, int l, int x[]) {
int ct = 0;
for (int i1 = 0; i1 <= 3 && ct < maxval; i1++)
for (int i2 = i1; i2 <= 3 && ct < maxval; i2++)
for (int i3 = i2; i3 <= 3 && ct < maxval; i3++)
for (int i4 = i3; i4 <= 3 && ct < maxval; i4++)
for (int i5 = i4; i5 <= 3 && ct < maxval; i5++)
for (int i6 = i5; i6 <= 3 && ct < maxval; i6++)
for (int i7 = i6; i7 <= 3 && ct < maxval; 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 = 0;
for (int j = 2; j < 8; j++){
idx+=(1 << (j - 2)) * !!(x[i] & (1 << j));
}
v[idx].push_back(x[i] & 3);
}
for (int i = 0; i < n; i++){
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... |