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 <vector>
#include <queue>
#include <iostream>
#include <cstring>
using namespace std;
void go(int x) {
for (int i = 0; i < 10; ++i) {
if (x&(1 << i))encode_bit(1);
else encode_bit(0);
}
}
bool used[1007];
int ans[1007];
vector<int> g[1007];
void encode(int nv, int nh, int ne, int *v1, int *v2) {
for (int i = 0; i < ne; ++i) {
g[v1[i]].push_back(v2[i]); g[v2[i]].push_back(v1[i]);
}
for (int i = 0; i < nh; ++i) {
queue<int> q;
memset(used, 0, sizeof(used));
memset(ans, 0, sizeof(ans));
used[i] = true;
ans[i] = 0;
q.push(i);
while (!q.empty()) {
int v = q.front(); q.pop();
for (int to : g[v]) {
if (used[to])continue;
used[to] = true;
ans[to] = ans[v] + 1;
q.push(to);
}
}
for (int j = 0; j < nv; ++j) {
go(ans[j]);
}
}
return;
}
#include "grader.h"
#include "decoder.h"
int get() {
int x = 0;
for (int i = 0; i < 10; ++i) {
if (decode_bit() == 1)x += (1 << i);
}
return x;
}
void decode(int nv, int nh) {
for (int i = 0; i < nh; ++i) {
for (int j = 0; j < nv; ++j) {
int u = get();
hops(i, j, u);
}
}
}
# | 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... |