#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<8;j++)
{
if(M[i]&(1<<j))
{
if(i>15)
{
send(j+(i-16)*10);
send(j+(i-16)*10);
}
else
{
send(j+i*10);
}
}
}
}
}
#include "decoder.h"
#include "decoderlib.h"
#include <algorithm>
#include <iostream>
#include <map>
using namespace std;
map < int , int > mp;
void decode(int N, int L, int X[])
{
int a[260];
for(int i=0;i<N;i++)
a[i]=0;
int x;
for(int i=0;i<L;i++)
mp[X[i]]++;
int f,s;
for(auto m:mp)
{
f=m.first;
s=m.second;
if(f!=0)
{
x=f%10;
f/=10;
}
else
x=0;
if(s>1)
{
a[f+16]+=(1<<x);
s-=2;
}
if(s==1)
{
a[f]+=(1<<x);
}
}
mp.clear();
for(int i=0;i<N;i++)
output(a[i]);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
752 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
1736 KB |
Output is correct |
2 |
Correct |
8 ms |
1952 KB |
Output is correct |
3 |
Correct |
8 ms |
2088 KB |
Output is correct |
4 |
Correct |
8 ms |
2160 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
2192 KB |
Output is correct |
2 |
Correct |
6 ms |
2192 KB |
Output is correct |
3 |
Correct |
9 ms |
2192 KB |
Output is correct |
4 |
Correct |
4 ms |
2208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
2208 KB |
Output is correct |
2 |
Correct |
8 ms |
2208 KB |
Output is correct |
3 |
Correct |
10 ms |
2208 KB |
Output is correct |
4 |
Incorrect |
7 ms |
2208 KB |
Error : Encoded message too long |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
8 ms |
2248 KB |
Output is partially correct - P = 8.000000 |
2 |
Partially correct |
11 ms |
2248 KB |
Output is partially correct - P = 12.000000 |
3 |
Partially correct |
12 ms |
2248 KB |
Output is partially correct - P = 12.121212 |
4 |
Incorrect |
4 ms |
2248 KB |
Error : Bad encoded integer |
5 |
Incorrect |
4 ms |
2248 KB |
Error : Bad encoded integer |
6 |
Incorrect |
5 ms |
2248 KB |
Error : Bad encoded integer |
7 |
Incorrect |
5 ms |
2248 KB |
Error : Bad encoded integer |