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 <stdlib.h>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
static int Que[1005], Qf, Qr;
static vector<int> Gph[1005];
static int Len[1005];
static bool visited[1005];
void send (ll v, int b) {
for(int i = 0; i < b; i++) encode_bit(!!((v>>i)&1));
}
void encode(int nv, int nh, int ne, int *v1, int *v2){
int i, j;
for(i = 0; i < ne; i++) {
int u = v1[i], v = v2[i];
Gph[u].push_back(v);
Gph[v].push_back(u);
}
for(i = 0; i < nh; i++) {
Qf = Qr = 0; Que[++Qr] = i;
memset(visited, 0, sizeof visited);
memset(Len, 0, sizeof Len);
visited[i] = true;
while(Qf < Qr) {
int u = Que[++Qf];
//printf("%d ", u);
for(j = 0; j < Gph[u].size(); j++) {
int v = Gph[u][j];
if(!visited[v]) visited[v] = true, Len[v] = Len[u]+1, visited[v] = true, Que[++Qr] = v;
}
}
//puts("");
for(j = 0; j < nv; j++) send(Len[j], 10);
}
}
#include "grader.h"
#include "decoder.h"
#include <stdlib.h>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll get (int b) {
int i; ll ret = 0;
for(i = 0; i < b; i++) if(decode_bit()) ret |= 1ll << i;
return ret;
}
void decode(int nv, int nh) {
for(int i = 0; i < nh; i++) {
for(int j = 0; j < nv; j++) {
hops(i, j, get(10));
}
}
}
Compilation message (stderr)
encoder.cpp: In function 'void encode(int, int, int, int*, int*)':
encoder.cpp:36:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(j = 0; j < Gph[u].size(); j++) {
~~^~~~~~~~~~~~~~~
# | 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... |