이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "encoder.h"
#include "encoderlib.h"
# include <bits/stdc++.h>
using namespace std;
# define x first
# define y second
# define ll long long
# define vi vector < int >
# define vl vector < ll >
# define pii pair < int , int >
# define mp make_pair
# define vii vector < pii >
# define pb push_back
template < class T > T smin(T &a,T b) {if (a > b) a = b;return a;}
template < class T > T smax(T &a,T b) {if (a < b) a = b;return a;}
void encode(int N, int M[])
{
int n = N;
static vi v[1 << 20];
int cnt = -1;
for (int i = 0;i <= 7;++i)
for (int j = 0;j <= 7;++j)
for (int k = 0;k <= 7;++k)
for (int l = 0;l <= 7;++l)
if (i + j + k + l <= 7)
++cnt,v[cnt] = {i,j,k,l};
for (int i = 0; i < n; i++)
{
const int cur = M[i];
for (int j = 0;j < 4;++j)
for (int k = 0;k < v[cur][j];++k)
send(i * 4 + j);
}
}
#include "decoder.h"
#include "decoderlib.h"
# include <bits/stdc++.h>
using namespace std;
# define x first
# define y second
# define ll long long
# define vi vector < int >
# define vl vector < ll >
# define pii pair < int , int >
# define mp make_pair
# define vii vector < pii >
# define pb push_back
template < class T > T smin(T &a,T b) {if (a > b) a = b;return a;}
template < class T > T smax(T &a,T b) {if (a < b) a = b;return a;}
void decode(int N, int L, int X[])
{
static map < vi , int > M;
M.clear();
int cnt = -1;
for (int i = 0;i <= 7;++i)
for (int j = 0;j <= 7;++j)
for (int k = 0;k <= 7;++k)
for (int l = 0;l <= 7;++l)
if (i + j + k + l <= 7)
M[{i,j,k,l}] = ++cnt;
int n = N;
vi ss[n];
for (int i = 0;i < n;++i)
ss[i].resize(4);
for (int i = 0;i < n;++i)
for (int j = 0;j < 4;++j)
ss[i][j] = 0;
for (int i = 0;i < L;++i)
{
int cnt = X[i];
int pos = cnt / 4;
cnt %= 4;
ss[pos][cnt] += 1;
}
for (int i = 0; i < n; i++)
output(M[{ss[i][0],ss[i][1],ss[i][2],ss[i][3]}]);
}
# | 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... |