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 "grader.h"
#include "encoder.h"
#include <bits/stdc++.h>
using namespace std;
void encode(int nv, int nh, int ne, int *v1, int *v2) {
vector<vector<int>> g(nv);
for (int i = 0; i < ne; i++) {
g[v1[i]].push_back(v2[i]);
g[v2[i]].push_back(v1[i]);
}
for (int h = 0; h < nh; h++) {
vector<int> dist(nv, -1);
dist[h] = 0;
vector<int> que(1, h);
for (int b = 0; b < (int) que.size(); b++) {
int i = que[b];
for (int j : g[i]) {
if (dist[j] == -1) {
dist[j] = dist[i] + 1;
que.push_back(j);
}
}
}
for (int i = 0; i < nv; i++) {
for (int b = 0; b < 10; b++) {
if (dist[i] >> b & 1) {
encode_bit(1);
} else {
encode_bit(0);
}
}
}
}
return;
}
#include "grader.h"
#include "decoder.h"
#include <bits/stdc++.h>
using namespace std;
void decode(int nv, int nh) {
for (int h = 0; h < nh; h++) {
for (int i = 0; i < nv; i++) {
int d = 0;
for (int b = 0; b < 10; b++) {
if (decode_bit() == 1) {
d += (1 << b);
}
}
hops(h, i, d);
}
}
}
# | 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... |