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;
namespace {
int n, h, m;
vector<int> link[1002];
int dist[1002][1002];
bool visited[1002][1002];
}
void encode(int nv, int nh, int ne, int *v1, int *v2){
n = nv, h = nh, m = ne;
for(int i=0; i<m; i++){
link[v1[i]].push_back(v2[i]);
link[v2[i]].push_back(v1[i]);
}
for(int s=0; s<h; s++){
queue<pair<int, int> > que;
que.push(make_pair(s, 0));
visited[s][s] = 1;
while(!que.empty()){
auto &[x, d] = que.front(); que.pop();
for(int y: link[x]){
if(visited[s][y]) continue;
visited[s][y] = 1, dist[s][y] = d+1;
que.push(make_pair(y, d+1));
}
}
}
for(int i=0; i<h; i++) for(int j=0; j<n; j++) for(int d=0; d<10; d++){
encode_bit((dist[i][j] >> d) & 1);
}
}
#include "grader.h"
#include "decoder.h"
#include <bits/stdc++.h>
using namespace std;
namespace {
int n, h;
}
void decode(int nv, int nh){
n = nv, h = nh;
for(int i=0; i<h; i++) for(int j=0; j<n; j++){
int s = 0;
for(int d=0; d<10; d++) s += decode_bit() << d;
hops(i, j, s);
}
}
# | 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... |