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 <iostream>
using namespace std;
int dist[1001][1001];
void encode(int nv, int nh, int ne, int *v1, int *v2){
for (int i = 0; i < nv; i++)
for (int j = 0; j < nv; j++) dist[i][j] = 1000000;
for (int i = 0; i < ne; i++) {
dist[v1[i]][v2[i]] = 1;
dist[v2[i]][v1[i]] = 1;
}
for (int i = 0; i < nv; i++) dist[i][i] = 0;
for (int k = 0; k < nv; k++)
for (int i = 0; i < nv; i++)
for (int j = 0; j < nv; j++)
if (dist[i][j] > dist[i][k] + dist[k][j]) {
dist[i][j] = dist[i][k] + dist[k][j];
}
for (int i = 0; i < nv; i++) {
for (int h = 0; h < nh; h++) {
int d = dist[i][h];
for (int b = 9; b >= 0; b--) {
encode_bit(1 & (d >> b));
}
}
}
}
#include "grader.h"
#include "decoder.h"
void decode(int nv, int nh) {
for (int i = 0; i < nv; i++) {
for (int h = 0; h < nh; h++) {
int dist = 0;
for (int b = 0; b < 10; b++) {
dist <<= 1;
dist += decode_bit();
}
hops(h, i, dist);
}
}
}
# | 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... |