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;
#define pb(x) push_back(x);
vector<vector<int> > V2;
vector<int> akt2(4);
void gen2(int l, int i){
V2.pb(akt2);
if(l==0) return;
for(int j=i; j<4; j++){
akt2[j]++;
gen2(l-1, j);
akt2[j]--;
}
}
void encode(int N, int M[])
{
gen2(7, 0);
for(int i=0; i<N; i++){
for(int j=0; j<4; j++){
for(int k=0; k<V2[M[i]][j]; k++){
send(4*i+j);
}
}
}
}
#include "decoder.h"
#include "decoderlib.h"
#include<bits/stdc++.h>
using namespace std;
#define pb(x) push_back(x);
vector<vector<int> > V;
vector<int> akt(4);
void gen(int l, int i){
V.pb(akt);
if(l==0) return;
for(int j=i; j<4; j++){
akt[j]++;
gen(l-1, j);
akt[j]--;
}
}
void decode(int N, int L, int X[])
{
gen(7, 0);
//cout<<V.size();
sort(X, X+L);
int j=0;
for(int i=0; i<N; i++) {
vector<int> co(4);
while(j<L && X[j]<((i+1)*4)){
co[X[j++]-4*i]++;
}
for(int k=0; k<V.size(); k++){
if(co==V[k]){
output(k);
break;
}
}
}
}
Compilation message (stderr)
decoder.cpp: In function 'void decode(int, int, int*)':
decoder.cpp:28:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
28 | for(int k=0; k<V.size(); k++){
| ~^~~~~~~~~
# | 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... |