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;
void encode(int n, int a[])
{
// int i;
// for(i=0; i<N; i++)
// send(M[i]);
if (n <= 32){
for (int i = 0; i < n; i++){
for (int j = 0; j < 8; j++){
if (a[i] >> j & 1){
send(8 * i + j);
}
}
}
}
}
#include "decoder.h"
#include "decoderlib.h"
#include <bits/stdc++.h>
using namespace std;
void decode(int n, int l, int a[])
{
//l is length of encoded sequence
//n is the answer we need
int cnt[256];
for (int i = 0; i < l; i++) cnt[a[i]]++;
if (n <= 32){
int ans[n];
for (int i = 0; i < 256; i++){
if (cnt[i] == 1){
ans[i / 8] += 1 << (i % 8);
}
}
for (int i = 0; i < n; i++){
output(ans[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... |