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"
//#include "decoder.h"
//#include "decoderlib.h"
using namespace std;
void encode(int N, int M[]){
for(int i = 0; i < N; i ++){
send(M[i]);
send(M[i]);
}
vector<int> arr;
for(int i = 0; i < N; i ++){
arr.push_back(M[i]);
}
sort(arr.begin(), arr.end());
for(int i = 0; i < N; i ++){
for(int j = 0; j < N; j ++){
if(arr[j] == M[i]){
send(i * 16 + j);
M[i] = -1;
break;
}
}
}
}
#include <bits/stdc++.h>
//#include "encoder.h"
//#include "encoderlib.h"
#include "decoder.h"
#include "decoderlib.h"
using namespace std;
void decode(int N, int L, int X[]){
map<int, int> arr;
for(int i = 0; i < L; i++){
arr[X[i]]++;
}
vector<int> ord, ans(N), brr;
for(auto[l, r] : arr){
for(int i = 0; i < r/2; i ++){
brr.push_back(l);
}
if(r % 2){
ord.push_back(l);
}
}
for(int k : ord){
int i = k / 16, j = k % 16;
ans[i] = brr[j];
}
for(int i : ans){
output(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... |