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<iostream>
#include "encoder.h"
#include "encoderlib.h"
using namespace std;
void encode(int n, int v[]){
int i, x;
for(i = 0; i < n; i++){
x = v[i];
send(i * 8 + x % 8);
x /= 8;
send(i * 8 + x % 8);
send(i * 8 + x % 8);
x /= 8;
send(i * 8 + x % 8);
send(i * 8 + x % 8);
send(i * 8 + x % 8);
send(i * 8 + x % 8);
}
}
#include<iostream>
#include<algorithm>
#include "decoder.h"
#include "decoderlib.h"
using namespace std;
void decode(int n, int m, int v[]){
int i, p, j, nr;
int sol[40];
for(i = 0; i < n; i++){
sol[i] = 0;
}
sort(v, v + m);
for(i = 0; i < m; i++){
nr = 1;
j = i;
while(v[j + 1] == v[i] && j + 1 < m){
j++;
nr++;
}
p = v[i] / 8;
v[i] %= 8;
if(nr >= 4){
sol[p] += v[i] * 64;
nr -= 4;
}
if(nr >= 2){
sol[p] += v[i] * 8;
nr -= 2;
}
if(nr == 1){
sol[p] += v[i];
}
i = j;
}
for(i = 0; i < n; i++){
output(sol[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... |