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>
void encodeNum(int x) {
for(int i = 0; i < 10; i++)
encode_bit(x&1<<i);
}
void encode(int N, int H, int P, int A[], int B[]){
int dis[N][N];
memset(dis, 1, sizeof dis);
for(int i = 0; i < P; i++) dis[A[i]][B[i]] = dis[B[i]][A[i]] = 1;
for(int i = 0; i < N; i++) dis[i][i] = 0;
for(int k = 0; k < N; k++)
for(int i = 0; i < N; i++)
for(int j = 0; j < N; j++)
dis[i][j] = std::min(dis[i][j], dis[i][k]+dis[k][j]);
for(int i = 0; i < H; i++)
for(int j = 0; j < N; j++)
encodeNum(dis[i][j]);
}
#include "grader.h"
#include "decoder.h"
int getNum() {
int res = 0;
for(int i = 0; i < 10; i++)
res+=(1<<i)*decode_bit();
return res;
}
void decode(int N, int H){
for(int i = 0; i < H; i++)
for(int j = 0; j < N; j++)
hops(i,j,getNum());
}
# | 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... |