#include "grader.h"
#include "encoder.h"
#include <vector>
#include <queue>
void send_int(int x, int nb)
{
for (int j = 0; j < nb; ++j) encode_bit((x >> j) & 1);
}
#define N 1001
using namespace std;
vector<int> g[N];
int n, h;
vector<int> bfs(int u)
{
vector<int> d(n, 1e9);
queue<pair<int, int>> q;
q.emplace(d[u] = 0, u);
while (q.size())
{
auto [c, u] = q.front(); q.pop();
for (auto v : g[u])
{
if (c + 1 < d[v])
q.emplace(d[v] = c + 1, v);
}
}
return d;
}
void encode(int n0, int h0, int ne, int *v1, int *v2){
for (int i = 0; i < ne; ++i) g[v1[i]].push_back(v2[i]), g[v2[i]].push_back(v1[i]);
::n = n0; ::h = h0;
for (int i = 0; i < h; ++i)
{
auto d = bfs(i);
for (int j = 0; j < n; ++j)
{
if (d[j] <= 64) send_int(1, 1);
else send_int(0, 1);
send_int(d[j], 10);
}
}
return;
}
#include "grader.h"
#include "decoder.h"
unsigned read_int(int nb)
{
unsigned u = 0;
for (int j = 0; j < nb; ++j) u |= decode_bit() << j;
return u;
}
int n, h;
void decode(int v0, int h0) {
::n = v0; ::h = h0;
for (int i = 0; i < h; ++i)
{
for (int j = 0; j < n; ++j)
{
int small = read_int(1);
if (small)
hops(i, j, read_int(6));
else hops(i, j, read_int(10));
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
260 ms |
20636 KB |
Output isn't correct |
2 |
Incorrect |
2 ms |
12036 KB |
wrong parameter |
3 |
Incorrect |
49 ms |
14304 KB |
Output isn't correct |
4 |
Incorrect |
2 ms |
12032 KB |
wrong parameter |
5 |
Incorrect |
56 ms |
14476 KB |
Output isn't correct |
6 |
Incorrect |
60 ms |
14976 KB |
Output isn't correct |
7 |
Incorrect |
78 ms |
15120 KB |
Output isn't correct |
8 |
Incorrect |
54 ms |
14284 KB |
Output isn't correct |
9 |
Incorrect |
56 ms |
14284 KB |
wrong parameter |
10 |
Incorrect |
59 ms |
14328 KB |
Output isn't correct |
11 |
Incorrect |
73 ms |
14644 KB |
Output isn't correct |
12 |
Incorrect |
52 ms |
14508 KB |
wrong parameter |
13 |
Incorrect |
78 ms |
14724 KB |
Output isn't correct |
14 |
Incorrect |
53 ms |
14336 KB |
wrong parameter |
15 |
Incorrect |
56 ms |
14436 KB |
wrong parameter |
16 |
Incorrect |
71 ms |
14752 KB |
Output isn't correct |
17 |
Incorrect |
67 ms |
15116 KB |
Output isn't correct |
18 |
Incorrect |
72 ms |
14952 KB |
Output isn't correct |
19 |
Incorrect |
62 ms |
14712 KB |
Output isn't correct |
20 |
Incorrect |
95 ms |
15236 KB |
Output isn't correct |
21 |
Incorrect |
91 ms |
15256 KB |
Output isn't correct |
22 |
Incorrect |
73 ms |
14812 KB |
Output isn't correct |
23 |
Incorrect |
92 ms |
16060 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
260 ms |
20636 KB |
Output isn't correct |
2 |
Incorrect |
2 ms |
12036 KB |
wrong parameter |
3 |
Incorrect |
49 ms |
14304 KB |
Output isn't correct |
4 |
Incorrect |
2 ms |
12032 KB |
wrong parameter |
5 |
Incorrect |
56 ms |
14476 KB |
Output isn't correct |
6 |
Incorrect |
60 ms |
14976 KB |
Output isn't correct |
7 |
Incorrect |
78 ms |
15120 KB |
Output isn't correct |
8 |
Incorrect |
54 ms |
14284 KB |
Output isn't correct |
9 |
Incorrect |
56 ms |
14284 KB |
wrong parameter |
10 |
Incorrect |
59 ms |
14328 KB |
Output isn't correct |
11 |
Incorrect |
73 ms |
14644 KB |
Output isn't correct |
12 |
Incorrect |
52 ms |
14508 KB |
wrong parameter |
13 |
Incorrect |
78 ms |
14724 KB |
Output isn't correct |
14 |
Incorrect |
53 ms |
14336 KB |
wrong parameter |
15 |
Incorrect |
56 ms |
14436 KB |
wrong parameter |
16 |
Incorrect |
71 ms |
14752 KB |
Output isn't correct |
17 |
Incorrect |
67 ms |
15116 KB |
Output isn't correct |
18 |
Incorrect |
72 ms |
14952 KB |
Output isn't correct |
19 |
Incorrect |
62 ms |
14712 KB |
Output isn't correct |
20 |
Incorrect |
95 ms |
15236 KB |
Output isn't correct |
21 |
Incorrect |
91 ms |
15256 KB |
Output isn't correct |
22 |
Incorrect |
73 ms |
14812 KB |
Output isn't correct |
23 |
Incorrect |
92 ms |
16060 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
260 ms |
20636 KB |
Output isn't correct |
2 |
Incorrect |
2 ms |
12036 KB |
wrong parameter |
3 |
Incorrect |
49 ms |
14304 KB |
Output isn't correct |
4 |
Incorrect |
2 ms |
12032 KB |
wrong parameter |
5 |
Incorrect |
56 ms |
14476 KB |
Output isn't correct |
6 |
Incorrect |
60 ms |
14976 KB |
Output isn't correct |
7 |
Incorrect |
78 ms |
15120 KB |
Output isn't correct |
8 |
Incorrect |
54 ms |
14284 KB |
Output isn't correct |
9 |
Incorrect |
56 ms |
14284 KB |
wrong parameter |
10 |
Incorrect |
59 ms |
14328 KB |
Output isn't correct |
11 |
Incorrect |
73 ms |
14644 KB |
Output isn't correct |
12 |
Incorrect |
52 ms |
14508 KB |
wrong parameter |
13 |
Incorrect |
78 ms |
14724 KB |
Output isn't correct |
14 |
Incorrect |
53 ms |
14336 KB |
wrong parameter |
15 |
Incorrect |
56 ms |
14436 KB |
wrong parameter |
16 |
Incorrect |
71 ms |
14752 KB |
Output isn't correct |
17 |
Incorrect |
67 ms |
15116 KB |
Output isn't correct |
18 |
Incorrect |
72 ms |
14952 KB |
Output isn't correct |
19 |
Incorrect |
62 ms |
14712 KB |
Output isn't correct |
20 |
Incorrect |
95 ms |
15236 KB |
Output isn't correct |
21 |
Incorrect |
91 ms |
15256 KB |
Output isn't correct |
22 |
Incorrect |
73 ms |
14812 KB |
Output isn't correct |
23 |
Incorrect |
92 ms |
16060 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
260 ms |
20636 KB |
Output isn't correct |
2 |
Incorrect |
2 ms |
12036 KB |
wrong parameter |
3 |
Incorrect |
49 ms |
14304 KB |
Output isn't correct |
4 |
Incorrect |
2 ms |
12032 KB |
wrong parameter |
5 |
Incorrect |
56 ms |
14476 KB |
Output isn't correct |
6 |
Incorrect |
60 ms |
14976 KB |
Output isn't correct |
7 |
Incorrect |
78 ms |
15120 KB |
Output isn't correct |
8 |
Incorrect |
54 ms |
14284 KB |
Output isn't correct |
9 |
Incorrect |
56 ms |
14284 KB |
wrong parameter |
10 |
Incorrect |
59 ms |
14328 KB |
Output isn't correct |
11 |
Incorrect |
73 ms |
14644 KB |
Output isn't correct |
12 |
Incorrect |
52 ms |
14508 KB |
wrong parameter |
13 |
Incorrect |
78 ms |
14724 KB |
Output isn't correct |
14 |
Incorrect |
53 ms |
14336 KB |
wrong parameter |
15 |
Incorrect |
56 ms |
14436 KB |
wrong parameter |
16 |
Incorrect |
71 ms |
14752 KB |
Output isn't correct |
17 |
Incorrect |
67 ms |
15116 KB |
Output isn't correct |
18 |
Incorrect |
72 ms |
14952 KB |
Output isn't correct |
19 |
Incorrect |
62 ms |
14712 KB |
Output isn't correct |
20 |
Incorrect |
95 ms |
15236 KB |
Output isn't correct |
21 |
Incorrect |
91 ms |
15256 KB |
Output isn't correct |
22 |
Incorrect |
73 ms |
14812 KB |
Output isn't correct |
23 |
Incorrect |
92 ms |
16060 KB |
Output isn't correct |