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;
#define f first
#define s second
#define pb push_back
void encode(int nv, int nh, int ne, int *v1, int *v2){
int ans[40][1005];
vector<int> v[1005];
for(int i = 0; i < ne; i++)
{
v[v1[i]].pb(v2[i]);
v[v2[i]].pb(v1[i]);
}
for(int i = 0; i < nh; i++)
{
for(int j = 0; j < 1005; j++)
ans[i][j] = 1e9;
ans[i][i] = 0;
queue<pair<int,int> > pq;
pq.push({-0,i});
while(!pq.empty())
{
int val = -pq.front().f;
int nw = pq.front().s;
pq.pop();
for(auto go: v[nw])
{
if(val + 1 < ans[i][go])
{
ans[i][go] = val + 1;
pq.push({-ans[i][go],go});
}
}
}
}
for(int i = 0; i < nh; i++)
for(int j = 0; j < nv; j++)
{
for(int k = 0; k < 10; k++)
{
if((1<<k) & ans[i][j])
encode_bit(1);
else
encode_bit(0);
}
}
return;
}
#include "grader.h"
#include "decoder.h"
#include<bits/stdc++.h>
using namespace std;
#define f first
#define s second
#define pb push_back
void decode(int nv, int nh) {
for(int i = 0; i < nh; i++)
for(int j = 0; j < nv; j++)
{
int val = 0;
for(int k = 0; k < 10; k++)
{
int a = decode_bit();
val += a * (1<<k);
}
hops(i,j,val);
}
}
# | 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... |