이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "encoder.h"
#include "encoderlib.h"
#include<bits/stdc++.h>
using namespace std;
namespace encoder_var {
int faken;
int a[1005];
vector< vector<int> > v;
void perm(vector<int> x, int curr) {
if(v.size()==65536) return;
if(x.size()==12) {
v.push_back({});
for(int i:x) {
if(i!=-1) v[v.size()-1].push_back(i);
}
return;
}
for(int i=curr; i<8; i++) {
x.push_back(i);
perm(x, i);
x.pop_back();
}
}
};
void encode(int N, int M[])
{
using namespace encoder_var;
perm({}, -1);
for(int i=0; i<N; i+=2) {
int value;
if(i==N-1) {
value = M[i];
} else {
value = M[i] + M[i+1] * 256;
}
int init = i/2*8;
for(int j=0; j<v[value].size(); j++) {
send(v[value][j]+init);
}
}
}
#include "decoder.h"
#include "decoderlib.h"
#include<bits/stdc++.h>
using namespace std;
namespace decoder_var {
int faken;
int a[1005];
vector< vector<int> > v;
vector<int> tmp;
void perm(vector<int> x, int curr) {
if(v.size()==65536) return;
if(x.size()==12) {
v.push_back({});
for(int i:x) {
if(i!=-1) v[v.size()-1].push_back(i);
}
return;
}
for(int i=curr; i<8; i++) {
x.push_back(i);
perm(x, i);
x.pop_back();
}
}
};
void decode(int N, int L, int X[])
{
using namespace decoder_var;
sort(X, X+L);
int ptr = 0;
perm({}, -1);
for(int i=0; i<64; i+=2) {
int init = i/2*8;
tmp.clear();
while(ptr<L && X[ptr]<init+8) {
tmp.push_back(X[ptr]-init);
++ptr;
}
for(int j=0; j<v.size(); j++) {
if(v[j] == tmp) {
a[i+1] = j/256;
a[i] = j%256;
break;
}
}
}
for(int i=0; i<N; i++) output(a[i]);
}
컴파일 시 표준 에러 (stderr) 메시지
encoder.cpp: In function 'void encode(int, int*)':
encoder.cpp:40:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
40 | for(int j=0; j<v[value].size(); j++) {
| ~^~~~~~~~~~~~~~~~
decoder.cpp: In function 'void decode(int, int, int*)':
decoder.cpp:42:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
42 | for(int j=0; j<v.size(); j++) {
| ~^~~~~~~~~
# | 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... |