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;
const int MAX_N = 1000;
vector <int> graph[MAX_N];
int dist[MAX_N][MAX_N];
void encode(int nv, int nh, int ne, int *v1, int *v2) {
for(int i = 0; i < ne; i++) {
graph[v1[i]].push_back(v2[i]);
graph[v2[i]].push_back(v1[i]);
}
for(int i = 0; i < nh; i++) {
for(int j = 0; j < nv; j++) {
dist[i][j] = -1;
}
queue <int> q;
dist[i][i] = 0;
q.push(i);
while(!q.empty()) {
int u = q.front();
q.pop();
for(auto v : graph[u]) {
if(dist[i][v] == -1) {
dist[i][v] = dist[i][u] + 1;
q.push(v);
}
}
}
}
for(int i = 0; i < nh; i++) {
for(int j = 0; j < nv; j++) {
for(int k = 0; k < 10; k++) {
if((1<<k) & dist[i][j]) {
encode_bit(1);
}
else {
encode_bit(0);
}
}
}
}
}
#include <bits/stdc++.h>
#include "grader.h"
#include "decoder.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 sum = 0;
for(int k = 0; k < 10; k++) {
sum += (1<<k) * decode_bit();
}
cout << i << ' ' << j << " : " << sum << endl;
hops(i, j, sum);
}
}
}
# | 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... |