#include "encoder.h"
#include "encoderlib.h"
#include <bits/stdc++.h>
using namespace std;
void encode(int N, int M[])
{
for(int i=0; i<N; i++)
{
for (int j=0; j<4; j++)
{
int tmp=16*(i/2);
tmp+=j*4;
tmp+=(M[i]&((1<<(2*j))+(1<<(2*j+1))))>>(2*j);
send(tmp);
if (i%2==1) send(tmp);
}
}
}
#include "decoder.h"
#include "decoderlib.h"
#include <bits/stdc++.h>
using namespace std;
void decode(int N, int L, int X[])
{
vector<int> ans(N);
int id, k;
map<int, int> mp;
for (int i=0; i<L; i++) mp[X[i]]++;
for (auto [x, y]:mp)
{
k=(x/4)%4;
if (y==1)
{
id=(x/16)*2;
ans[id]+=(x%2)<<(2*k);
ans[id]+=((x/2)%2)<<(2*k+1);
}
if (y==2)
{
id=(x/16)*2+1;
ans[id]+=(x%2)<<(2*k);
ans[id]+=((x/2)%2)<<(2*k+1);
}
if (y==3)
{
id=(x/16)*2;
ans[id]+=(x%2)<<(2*k);
ans[id]+=((x/2)%2)<<(2*k+1);
id=(x/16)*2+1;
ans[id]+=(x%2)<<(2*k);
ans[id]+=((x/2)%2)<<(2*k+1);
}
}
for (int i=0; i<N; i++) output(ans[i]);
}
/*
10
1 1 2 1 2 3 1 7 10 9
*/
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
796 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1308 KB |
Output is correct |
2 |
Correct |
2 ms |
1300 KB |
Output is correct |
3 |
Correct |
2 ms |
1324 KB |
Output is correct |
4 |
Correct |
2 ms |
1316 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
1304 KB |
Output is correct |
2 |
Correct |
2 ms |
1304 KB |
Output is correct |
3 |
Correct |
2 ms |
1324 KB |
Output is correct |
4 |
Correct |
2 ms |
1316 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
1304 KB |
Output is correct |
2 |
Correct |
3 ms |
1316 KB |
Output is correct |
3 |
Correct |
2 ms |
1328 KB |
Output is correct |
4 |
Correct |
3 ms |
1356 KB |
Output is correct |
5 |
Correct |
3 ms |
1344 KB |
Output is correct |
6 |
Correct |
4 ms |
1504 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
2 ms |
1312 KB |
Output is partially correct - P = 6.000000 |
2 |
Partially correct |
3 ms |
1336 KB |
Output is partially correct - P = 6.000000 |
3 |
Incorrect |
1 ms |
784 KB |
Error : Bad encoded integer |
4 |
Incorrect |
0 ms |
796 KB |
Error : Bad encoded integer |
5 |
Incorrect |
0 ms |
796 KB |
Error : Bad encoded integer |
6 |
Incorrect |
1 ms |
780 KB |
Error : Bad encoded integer |
7 |
Incorrect |
0 ms |
784 KB |
Error : Bad encoded integer |