#include <bits/stdc++.h>
#include "encoder.h"
#include "encoderlib.h"
using namespace std;
int mapa2[1000];
map<int,int> mapa;
int broj = 0;
void rec(int posledno, int n, int s,int depth){
if(depth==7)
{
mapa[s]=broj;
mapa2[broj]=s;
//cout<<s<<" "<<broj<<endl;
broj++;
return;
}
for(int i =posledno;i<n;i++)
{
rec(i,n,s*10+i,depth+1);
}
}
void encode(int n, int a[])
{
broj = 0;
rec(0,5,0,0);
int start_from = 0;
for(int i =0;i<n;i++)
{
int x = mapa2[a[i]];
while (x>0)
{
send((x%10)-1+start_from);
x/=10;
}
start_from+=4;
}
}
#include <bits/stdc++.h>
#include "decoder.h"
#include "decoderlib.h"
using namespace std;
int mapa2[1000];
map<int,int> mapa;
int broj = 0;
void rec(int posledno, int n, int s,int depth){
if(depth==7)
{
mapa[s]=broj;
mapa2[broj]=s;
//cout<<s<<" "<<broj<<endl;
broj++;
return;
}
for(int i =posledno;i<n;i++)
{
rec(i,n,s*10+i,depth+1);
}
}
void decode(int n,int howmany2,int a[]){
broj = 0;
rec(0,5,0,0);
sort(a,a+howmany2);
int start_from = 0;
int current = 0;
for(int j =0;j<n;j++)
{
start_from=j*4;
current = 0;
for(int i = 0;i<howmany2;i++)
if (a[i]<start_from+4 && a[i]>=start_from)
current = (current*10)+a[i]-start_from+1;
output(mapa[current]);
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
788 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
1312 KB |
Output is correct |
2 |
Correct |
3 ms |
1312 KB |
Output is correct |
3 |
Correct |
3 ms |
1316 KB |
Output is correct |
4 |
Correct |
3 ms |
1324 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
1316 KB |
Output is correct |
2 |
Correct |
2 ms |
1320 KB |
Output is correct |
3 |
Correct |
3 ms |
1324 KB |
Output is correct |
4 |
Correct |
3 ms |
1620 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
1316 KB |
Output is correct |
2 |
Correct |
2 ms |
1168 KB |
Output is correct |
3 |
Correct |
3 ms |
1320 KB |
Output is correct |
4 |
Correct |
3 ms |
1332 KB |
Output is correct |
5 |
Correct |
5 ms |
1332 KB |
Output is correct |
6 |
Correct |
4 ms |
1384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
3 ms |
1316 KB |
Output is partially correct - P = 7.000000 |
2 |
Partially correct |
4 ms |
1468 KB |
Output is partially correct - P = 7.000000 |
3 |
Partially correct |
4 ms |
1336 KB |
Output is partially correct - P = 7.000000 |
4 |
Partially correct |
6 ms |
1368 KB |
Output is partially correct - P = 7.000000 |
5 |
Partially correct |
7 ms |
1380 KB |
Output is partially correct - P = 7.000000 |
6 |
Partially correct |
7 ms |
1384 KB |
Output is partially correct - P = 7.000000 |
7 |
Partially correct |
9 ms |
1480 KB |
Output is partially correct - P = 7.000000 |