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 <bits/stdc++.h>
#include "grader.h"
#include "encoder.h"
using namespace std;
void encode(int nv, int nh, int ne, int *v1, int *v2){
vector<vector<int>> adj(nv);
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<int> q({i});
vector<int> dist(nv, INT_MAX);
dist[i] = 0;
while(q.size()){
int a = q.front(); q.pop();
for (auto &b : adj[a]) {
if(dist[b] > dist[a] + 1){
dist[b] = dist[a] + 1;
q.push(b);
}
}
}
for (int i = 0; i < nv; i++) {
for (int b = 0; b < 9; b++) {
encode_bit((int)(dist[i] & (1 << b)));
}
}
}
return;
}
#include "grader.h"
#include "decoder.h"
#include <bits/stdc++.h>
using namespace std;
void decode(int nv, int nh) {
for (int i = 0; i < nh; i++){
for (int j = 0; j < nv; j++) {
int res = 0;
for (int k = 0, x = 1; k < 9; k++, x *= 2) {
if(decode_bit()){
res += x;
}
}
hops(i, j, res);
}
}
}
# | 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... |