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>
#define fori(a,b,c) for(a=b; a<c; a++)
#define ford(a,b,c) for(a=b; a>=c; a--)
#define mp make_pair
#define pb push_back
#define ll long long
#define pii pair<int,int>
using namespace std;
void encode(int N, int M[])
{
int i;
for(i=0; i<N; i++){
int x=2;
int y=0;
while(M[i]){
if(M[i]%x){
send(i*8+y);
M[i]-=(x/2);
}
y++;
x*=2;
}
}
}
#include "decoder.h"
#include "decoderlib.h"
#include<bits/stdc++.h>
#define fori(a,b,c) for(a=b; a<c; a++)
#define ford(a,b,c) for(a=b; a>=c; a--)
#define mp make_pair
#define pb push_back
#define ll long long
#define pii pair<int,int>
using namespace std;
int us[8]={1,2,4,8,16,32,64,128};
void decode(int N, int L, int X[])
{
sort(X,X+L);
int i,j,k;
j=0;
fori(i,0,N){
int cod=0;
while(j<L && X[j]<=i*8+7){
X[j]-=i*8;
cod+=us[X[j]];
j++;
}
output(cod);
}
}
Compilation message (stderr)
decoder.cpp: In function 'void decode(int, int, int*)':
decoder.cpp:17:10: warning: unused variable 'k' [-Wunused-variable]
int i,j,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... |