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 lol long long
#define pii pair<int,int>
#define OK puts("OK");
#define NO puts("NO");
#define YES puts("YES");
#define fr first
#define sc second
#define ret return
#define scanl(a) scanf("%lld",&a);
#define scanll(a,b) scanf("%lld %lld",&a, &b);
#define scanlll(a,b,c) scanf("%lld %lld %lld",&a,&b,&c);
#define scan1(a) scanf("%d",&a);
#define scan2(a,b) scanf("%d %d",&a, &b);
#define scan3(a,b,c) scanf("%d %d %d",&a,&b,&c);
#define all(s) s.begin(),s.end()
#define allr(s) s.rbegin(),s.rend()
#define pb push_back
#define sz(v) (int)v.size()
#define endi puts("");
#define eps 1e-12
void encode(int N, int M[]){
int i,j,xr=0;
for (i=0;i<8;++i){
int a=0,b=0;
for (j=0;j<N;++j){
if ((M[j]&(1<<i)))a++;
else b++;
}
if (a > b)xr|=(1<<i);
}
// send(xr);
// send(xr);
// send(xr);
// send(xr);
for(i=0; i<N; i++){
int x = (i<<2);
int m = M[i];
// m ^= xr;
{
int a = (m&1);
m = (m>>1);
int b = (m&1);
m = (m>>1);
if (a == 1)send(x);
if (b == 1){
send(x);
send(x);
}
}
x++;
{
int a = (m&1);
m = (m >> 1);
int b = (m&1);
m = (m >> 1);
if (a == 1)send(x);
if (b == 1){
send(x);
send(x);
}
}
x++;
{
int a = (m&1);
m = (m >> 1);
int b = (m&1);
m = (m >> 1);
if (a == 1)send(x);
if (b == 1){
send(x);
send(x);
}
}
x++;
{
int a = (m&1);
m = (m >> 1);
int b = (m&1);
m = (m >> 1);
if (a == 1)send(x);
if (b == 1){
send(x);
send(x);
}
}
}
}
#include "decoder.h"
#include "decoderlib.h"
#include <bits/stdc++.h>
using namespace std;
#define lol long long
#define pii pair<int,int>
#define OK puts("OK");
#define NO puts("NO");
#define YES puts("YES");
#define fr first
#define sc second
#define ret return
#define scanl(a) scanf("%lld",&a);
#define scanll(a,b) scanf("%lld %lld",&a, &b);
#define scanlll(a,b,c) scanf("%lld %lld %lld",&a,&b,&c);
#define scan1(a) scanf("%d",&a);
#define scan2(a,b) scanf("%d %d",&a, &b);
#define scan3(a,b,c) scanf("%d %d %d",&a,&b,&c);
#define all(s) s.begin(),s.end()
#define allr(s) s.rbegin(),s.rend()
#define pb push_back
#define sz(v) (int)v.size()
#define endi puts("");
#define eps 1e-12
int cnt[256],ans[256];
void decode(int N, int L, int X[]){
int i,xr=0;
for (i=0;i<L;++i)
cnt[X[i]]++;
for (i=0;i<L;++i){
if (cnt[X[i]] >= 4){
xr = X[i];
cnt[X[i]]-=4;
break;
}
}
for (i=0;i<256;++i){
if (cnt[i] > 0){
int x = (i&3);
if (x == 0){
ans[(i>>2)] += cnt[i];
}
if (x == 1){
ans[(i>>2)] += (cnt[i] <<2);
}
if (x == 2){
ans[(i>>2)] += (cnt[i] <<4);
}
if (x == 3){
ans[(i>>2)] += (cnt[i] <<6);
}
}
}
for (i=0;i<N;++i)
output(ans[i]);
}
Compilation message (stderr)
decoder.cpp: In function 'void decode(int, int, int*)':
decoder.cpp:28:11: warning: variable 'xr' set but not used [-Wunused-but-set-variable]
28 | int i,xr=0;
| ^~
# | 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... |