This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "encoder.h"
#include "encoderlib.h"
#include <bits/stdc++.h>
using namespace std;
void encode(int N, int M[])
{
vector < int > vc;
int ind = 0;
for ( int i = 0; i < N; i++ ) {
int x = M[i];
if ( x < 10 ) {
vc.push_back( ind++ );
vc.push_back( ind++ );
vc.push_back( x * 100 + ind++ );
}
else if ( x < 100 ) {
vc.push_back( ind++ );
int y = x / 10;
vc.push_back( y * 100 + ind++ );
y = x % 10;
vc.push_back( y * 100 + ind++ );
}
else {
int y = x / 100;
vc.push_back( y * 100 + ind++ );
y = (x % 100) / 10;
vc.push_back( y * 100 + ind++ );
y = x % 10;
vc.push_back( y * 100 + ind++ );
}
}
for ( auto i: vc ) {
send(i);
// cout << i << ' ';
}
// cout << '\n';
}
#include "decoder.h"
#include "decoderlib.h"
#include <bits/stdc++.h>
using namespace std;
void decode(int N, int L, int X[])
{
map < int, int > mp;
for ( int i = 0; i < L; i++ ) {
int x = X[i] % 10;
int y = X[i] % 100 / 10;
mp[ y * 10 + x ] = X[i] / 100;
}
int ind = 0;
for ( int i = 0; i < N; i++ ) {
int x = mp[ind++], y = mp[ind++], z = mp[ind++];
int ans = x * 100 + y * 10 + z;
output(ans);
// cout << ans << ' ';
}
// cout << '\n';
}
# | 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... |