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"
/*
Strategy:
*) Encoder:
Encoder will send the following number: xxxxyyzz
xxxx is the index of the number in the original message
yy is which quarter of the message we're sending (33221100)
zz are the two bits of the yy quarter of the value in the original message
This encoder will send 4*N messages of length 8
*) Decoder:
Decoder will take the given numbers xxxxyyzz and create an array with the original message
*/
int sendValue( int i, int q, int Mi ){
int rv = i;
rv <<= 2;
rv |= q;
rv <<= 2;
int _Mi = (Mi & (1<<(2*q+1))) | (Mi & (1<<(2*q)));
rv |= _Mi;
return rv;
}
void encode( int N, int M[] ){
for( int i = 0 ; i < N ; i++ ){
for( int q = 0 ; q < 3 ; q++ ) send( sendValue( i, q, M[i] ) );
}
}
#include<bits/stdc++.h>
#include"decoder.h"
#include"decoderlib.h"
/*
Strategy:
*) Encoder:
Encoder will send the following number: xxxxyyzz
xxxx is the index of the number in the original message
yy is which quarter of the message we're sending (33221100)
zz are the two bits of the yy quarter of the value in the original message
This encoder will send 4*N messages of length 8
*) Decoder:
Decoder will take the given numbers xxxxyyzz and create an array with the original message
*/
void recieveValue( int Xi, int &x, int &y, int &z ){
z = Xi & (0b11);
Xi >>= 2;
y = Xi & (0b11);
Xi >>= 2;
x = Xi;
}
void decode( int N, int L, int X[] ){
int A[N] = {}; for( int &i : A ) i = 0;
int x, y, z;
for( int i = 0 ; i < L ; i++ ){
recieveValue( X[i], x, y, z );
A[x] |= ( bool(z&2) << (2*y+1) ) | ( bool(z&1) << (2*y) );
}
for( int i = 0 ; i < N ; i++ ) output(A[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... |