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 solve(int k, int i){
int c = k % 10, b = (k / 10) % 10, a = k / 100;
int qtd_a = a / 3, qtd_b = b / 3, qtd_c = c / 3;
for(int j=0; j<qtd_a; j++){
int x = i * (1 << 4) + 0 * (1 << 2) + 3;
// cout << x << " ";
send(x);
}
send(i * (1 << 4) + 0 * (1 << 2) + a % 3);
// cout << i * (1 << 4) + 0 * (1 << 2) + a % 3 << ", ";
for(int j=0; j<qtd_b; j++){
int x = i * (1 << 4) + 1 * (1 << 2) + 3;
// cout << x << " ";
send(x);
}
send(i * (1 << 4) + 1 * (1 << 2) + b % 3);
// cout << i * (1 << 4) + 1 * (1 << 2) + b % 3 << ", ";
for(int j=0; j<qtd_c; j++){
int x = i * (1 << 4) + 2 * (1 << 2) + 3;
// cout << x << " ";
send(x);
}
send(i * (1 << 4) + 2 * (1 << 2) + c % 3);
// cout << i * (1 << 4) + 2 * (1 << 2) + c % 3 << "\n";
}
void encode(int n, int m[]){
for(int i=0; i<n; i++){
solve(m[i], i);
}
}
#include "decoder.h"
#include "decoderlib.h"
#include <bits/stdc++.h>
using namespace std;
void decode(int n, int l, int x[]){
vector<vector<int>> id(n);
for(int i=0; i<l; i++){
id[x[i] >> 4].push_back(x[i] - ((x[i] >> 4) * (1 << 4))); // fica so 4 bits
}
for(int i=0; i<n; i++){
vector<int> dig(3, 0);
for(auto k : id[i]){
int alg = k >> 2;
int sum = k - ((k >> 2) * (1 << 2));
dig[alg] += sum;
// cout << k << " " << alg << " " << sum << endl;
}
// cout << dig[0] * 100 + dig[1] * 10 + dig[2] << endl;
output(dig[0] * 100 + dig[1] * 10 + dig[2]);
}
}
# | 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... |