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 <iostream>
#include <vector>
#include <tuple>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <map>
#include <cmath>
#include <random>
#include <string>
#include <cassert>
#include <climits>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>
#include "encoder.h"
#include "encoderlib.h"
using namespace std;
void encode(int N, int M[]) {
string s;
for (int i = 0; i < N; i++) {
for (int j = 7; j >= 0; j--) {
if (M[i] >= (1 << j)) {
s += '1';
M[i] -= (1 << j);
} else {
s += '0';
}
}
}
for (int i = 0; i < 8 * N; i++) {
if (s[i] == '1') {
send(i);
}
}
}
#include <iostream>
#include <vector>
#include <tuple>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <map>
#include <cmath>
#include <random>
#include <string>
#include <cassert>
#include <climits>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>
#include "decoder.h"
#include "decoderlib.h"
using namespace std;
void decode(int N, int L, int X[]) {
string s(8 * N, '0');
for (int i = 0; i < L; i++) {
s[X[i]] = '1';
}
vector<int> ans;
for (int i = 0, curr; i < 8 * N;) {
curr = 0;
for (int j = 7; j >= 0; j--) {
if (s[i] == '1') {
curr += (1 << j);
}
i++;
}
ans.push_back(curr);
}
for (int i = 0; i < N; i++) {
cout << ans[i] << " ";
output(ans[i]);
}
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... |