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;
vector<int> adj[1001];
void code(int num)
{
for (int i = 0; i < 10; i++)
{
bool bit = num & (1 << i);
encode_bit(bit);
}
}
void encode(int nv, int nh, int ne, int *v1, int *v2){
for (int i = 0; i < ne; i++)
{
adj[v1[i]].push_back(v2[i]);
adj[v2[i]].push_back(v1[i]);
}
for (int i = 0; i < nh; i++)
{
queue<array<int, 2>> que;
que.push({i, 0});
vector<int> vis(nv);
vector<int> val(nv);
vis[i] = true;
while (!que.empty())
{
auto cur = que.front();
que.pop();
val[cur[0]] = cur[1];
for (int next : adj[cur[0]])
{
if (vis[next]) continue;
vis[next] = true;
que.push({next, cur[1] + 1});
}
}
for (int i = 0; i < nv; i++) code(val[i]);
}
return;
}
#include "grader.h"
#include "decoder.h"
#include <bits/stdc++.h>
using namespace std;
int code()
{
int num = 0;
for (int i = 0, fact = 1; i < 10; fact *= 2, i++)
{
num += decode_bit() * fact;
}
return num;
}
void decode(int nv, int nh) {
for (int i = 0; i < nh; i++)
{
for (int j = 0; j < nv; j++)
{
hops(i, j, code());
}
}
}
# | 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... |