#include "grader.h"
#include "encoder.h"
int const N = 1e3 + 9;
int const H = 40;
int d[H][N];
bool odw[H][N];
int G[N][N];
int R[N];
void dfs(int v, int in, int w) {
odw[in][v] = true;
d[in][v] = w;
for (int i = 0; i < R[v]; i++) {
int sas = G[v][i];
if (!odw[in][sas])
dfs(sas, in, w + 1);
}
}
void int_to_bits(int a) { //9 bitów
int pot = 1 << 9;
while (a > 0) {
if (a > pot) {
encode_bit(1);
a -= pot;
}
else encode_bit(0);
pot >>= 1;
}
}
void encode(int nv, int nh, int ne, int* v1, int* v2) {
for (int i = 0; i < ne; i++) {
G[v1[i]][R[v1[i]]] = v2[i];
R[v1[i]]++;
G[v2[i]][R[v2[i]]] = v1[i];
R[v2[i]]++;
}
for (int h = 0; h < nh; h++) {
dfs(h, h, 0);
for (int v = 0; v < nv; v++) {
int_to_bits(d[h][v]);
}
}
return;
}
#include "grader.h"
#include "decoder.h"
void decode(int nv, int nh) {
for (int h = 0; h < nh; h++) {
for (int v = 0; v < nv; v++) {
int mn = 1;
int a = 0;
for (int i = 0; i < 9; i++) {
int bit = decode_bit();
a += bit * mn;
mn <<= 2;
}
hops(h, v, a);
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
335 ms |
69232 KB |
too many calls to encode_bit(b) function |
2 |
Incorrect |
79 ms |
63052 KB |
too many calls to encode_bit(b) function |
3 |
Incorrect |
86 ms |
66844 KB |
too many calls to encode_bit(b) function |
4 |
Incorrect |
81 ms |
63036 KB |
too many calls to encode_bit(b) function |
5 |
Incorrect |
89 ms |
67108 KB |
too many calls to encode_bit(b) function |
6 |
Incorrect |
89 ms |
67272 KB |
too many calls to encode_bit(b) function |
7 |
Incorrect |
98 ms |
67440 KB |
too many calls to encode_bit(b) function |
8 |
Incorrect |
100 ms |
67080 KB |
too many calls to encode_bit(b) function |
9 |
Incorrect |
82 ms |
67356 KB |
too many calls to encode_bit(b) function |
10 |
Incorrect |
87 ms |
67348 KB |
too many calls to encode_bit(b) function |
11 |
Incorrect |
87 ms |
67464 KB |
too many calls to encode_bit(b) function |
12 |
Incorrect |
97 ms |
67268 KB |
too many calls to encode_bit(b) function |
13 |
Incorrect |
102 ms |
67544 KB |
too many calls to encode_bit(b) function |
14 |
Incorrect |
85 ms |
67208 KB |
too many calls to encode_bit(b) function |
15 |
Incorrect |
85 ms |
67212 KB |
too many calls to encode_bit(b) function |
16 |
Incorrect |
121 ms |
67468 KB |
too many calls to encode_bit(b) function |
17 |
Incorrect |
110 ms |
67392 KB |
too many calls to encode_bit(b) function |
18 |
Incorrect |
122 ms |
67660 KB |
too many calls to encode_bit(b) function |
19 |
Incorrect |
101 ms |
67356 KB |
too many calls to encode_bit(b) function |
20 |
Incorrect |
110 ms |
67672 KB |
too many calls to encode_bit(b) function |
21 |
Incorrect |
147 ms |
67748 KB |
too many calls to encode_bit(b) function |
22 |
Incorrect |
119 ms |
67468 KB |
too many calls to encode_bit(b) function |
23 |
Incorrect |
116 ms |
67800 KB |
too many calls to encode_bit(b) function |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
335 ms |
69232 KB |
too many calls to encode_bit(b) function |
2 |
Incorrect |
79 ms |
63052 KB |
too many calls to encode_bit(b) function |
3 |
Incorrect |
86 ms |
66844 KB |
too many calls to encode_bit(b) function |
4 |
Incorrect |
81 ms |
63036 KB |
too many calls to encode_bit(b) function |
5 |
Incorrect |
89 ms |
67108 KB |
too many calls to encode_bit(b) function |
6 |
Incorrect |
89 ms |
67272 KB |
too many calls to encode_bit(b) function |
7 |
Incorrect |
98 ms |
67440 KB |
too many calls to encode_bit(b) function |
8 |
Incorrect |
100 ms |
67080 KB |
too many calls to encode_bit(b) function |
9 |
Incorrect |
82 ms |
67356 KB |
too many calls to encode_bit(b) function |
10 |
Incorrect |
87 ms |
67348 KB |
too many calls to encode_bit(b) function |
11 |
Incorrect |
87 ms |
67464 KB |
too many calls to encode_bit(b) function |
12 |
Incorrect |
97 ms |
67268 KB |
too many calls to encode_bit(b) function |
13 |
Incorrect |
102 ms |
67544 KB |
too many calls to encode_bit(b) function |
14 |
Incorrect |
85 ms |
67208 KB |
too many calls to encode_bit(b) function |
15 |
Incorrect |
85 ms |
67212 KB |
too many calls to encode_bit(b) function |
16 |
Incorrect |
121 ms |
67468 KB |
too many calls to encode_bit(b) function |
17 |
Incorrect |
110 ms |
67392 KB |
too many calls to encode_bit(b) function |
18 |
Incorrect |
122 ms |
67660 KB |
too many calls to encode_bit(b) function |
19 |
Incorrect |
101 ms |
67356 KB |
too many calls to encode_bit(b) function |
20 |
Incorrect |
110 ms |
67672 KB |
too many calls to encode_bit(b) function |
21 |
Incorrect |
147 ms |
67748 KB |
too many calls to encode_bit(b) function |
22 |
Incorrect |
119 ms |
67468 KB |
too many calls to encode_bit(b) function |
23 |
Incorrect |
116 ms |
67800 KB |
too many calls to encode_bit(b) function |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
335 ms |
69232 KB |
too many calls to encode_bit(b) function |
2 |
Incorrect |
79 ms |
63052 KB |
too many calls to encode_bit(b) function |
3 |
Incorrect |
86 ms |
66844 KB |
too many calls to encode_bit(b) function |
4 |
Incorrect |
81 ms |
63036 KB |
too many calls to encode_bit(b) function |
5 |
Incorrect |
89 ms |
67108 KB |
too many calls to encode_bit(b) function |
6 |
Incorrect |
89 ms |
67272 KB |
too many calls to encode_bit(b) function |
7 |
Incorrect |
98 ms |
67440 KB |
too many calls to encode_bit(b) function |
8 |
Incorrect |
100 ms |
67080 KB |
too many calls to encode_bit(b) function |
9 |
Incorrect |
82 ms |
67356 KB |
too many calls to encode_bit(b) function |
10 |
Incorrect |
87 ms |
67348 KB |
too many calls to encode_bit(b) function |
11 |
Incorrect |
87 ms |
67464 KB |
too many calls to encode_bit(b) function |
12 |
Incorrect |
97 ms |
67268 KB |
too many calls to encode_bit(b) function |
13 |
Incorrect |
102 ms |
67544 KB |
too many calls to encode_bit(b) function |
14 |
Incorrect |
85 ms |
67208 KB |
too many calls to encode_bit(b) function |
15 |
Incorrect |
85 ms |
67212 KB |
too many calls to encode_bit(b) function |
16 |
Incorrect |
121 ms |
67468 KB |
too many calls to encode_bit(b) function |
17 |
Incorrect |
110 ms |
67392 KB |
too many calls to encode_bit(b) function |
18 |
Incorrect |
122 ms |
67660 KB |
too many calls to encode_bit(b) function |
19 |
Incorrect |
101 ms |
67356 KB |
too many calls to encode_bit(b) function |
20 |
Incorrect |
110 ms |
67672 KB |
too many calls to encode_bit(b) function |
21 |
Incorrect |
147 ms |
67748 KB |
too many calls to encode_bit(b) function |
22 |
Incorrect |
119 ms |
67468 KB |
too many calls to encode_bit(b) function |
23 |
Incorrect |
116 ms |
67800 KB |
too many calls to encode_bit(b) function |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
335 ms |
69232 KB |
too many calls to encode_bit(b) function |
2 |
Incorrect |
79 ms |
63052 KB |
too many calls to encode_bit(b) function |
3 |
Incorrect |
86 ms |
66844 KB |
too many calls to encode_bit(b) function |
4 |
Incorrect |
81 ms |
63036 KB |
too many calls to encode_bit(b) function |
5 |
Incorrect |
89 ms |
67108 KB |
too many calls to encode_bit(b) function |
6 |
Incorrect |
89 ms |
67272 KB |
too many calls to encode_bit(b) function |
7 |
Incorrect |
98 ms |
67440 KB |
too many calls to encode_bit(b) function |
8 |
Incorrect |
100 ms |
67080 KB |
too many calls to encode_bit(b) function |
9 |
Incorrect |
82 ms |
67356 KB |
too many calls to encode_bit(b) function |
10 |
Incorrect |
87 ms |
67348 KB |
too many calls to encode_bit(b) function |
11 |
Incorrect |
87 ms |
67464 KB |
too many calls to encode_bit(b) function |
12 |
Incorrect |
97 ms |
67268 KB |
too many calls to encode_bit(b) function |
13 |
Incorrect |
102 ms |
67544 KB |
too many calls to encode_bit(b) function |
14 |
Incorrect |
85 ms |
67208 KB |
too many calls to encode_bit(b) function |
15 |
Incorrect |
85 ms |
67212 KB |
too many calls to encode_bit(b) function |
16 |
Incorrect |
121 ms |
67468 KB |
too many calls to encode_bit(b) function |
17 |
Incorrect |
110 ms |
67392 KB |
too many calls to encode_bit(b) function |
18 |
Incorrect |
122 ms |
67660 KB |
too many calls to encode_bit(b) function |
19 |
Incorrect |
101 ms |
67356 KB |
too many calls to encode_bit(b) function |
20 |
Incorrect |
110 ms |
67672 KB |
too many calls to encode_bit(b) function |
21 |
Incorrect |
147 ms |
67748 KB |
too many calls to encode_bit(b) function |
22 |
Incorrect |
119 ms |
67468 KB |
too many calls to encode_bit(b) function |
23 |
Incorrect |
116 ms |
67800 KB |
too many calls to encode_bit(b) function |