이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "encoder.h"
#include "encoderlib.h"
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define REP(n) FOR(O, 1, (n))
#define pb push_back
#define f first
#define s second
void encode(int N, int M[])
{
vector<pair<int, int>> toSend;
int cnt = 0;
FOR(i, 0, N-1) {
int le = M[i];
vector<int> toAdd;
REP(4) {
int a = le % (1<<2);
//cerr << " i = " << i << " a = " << a << endl;
toAdd.pb(a);
le >>= 2;
}
reverse(toAdd.begin(), toAdd.end());
for (int x : toAdd)
toSend.pb({cnt++, x});
}
for (auto p : toSend) {
send((p.f<<2) + p.s);
}
//for(i=0; i<N; i++)
// send(M[i]);
}
#include "decoder.h"
#include "decoderlib.h"
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define REP(n) FOR(O, 1, (n))
#define pb push_back
#define f first
#define s second
void decode(int N, int L, int X[])
{
vector<pair<int, int>> seq;
FOR(i, 0, L-1) {
int a = X[i] >> 2;
int b = X[i] - (a<<2);
seq.pb({a,b});
}
sort(seq.begin(), seq.end());
int cur =0;
FOR(i, 0, N-1) {
int rez = 0;
REP(4) {
rez <<= 2;
rez +=seq[cur].s;
cur++;
}
output(rez);
}
}
# | 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... |