#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 t = 0;
while(a > 0){
encode_bit(a % 2);
a /= 2;
t++;
}
while(t < 9){
encode_bit(0);
t++;
}
}
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 |
278 ms |
13396 KB |
wrong parameter |
2 |
Incorrect |
2 ms |
4584 KB |
wrong parameter |
3 |
Incorrect |
69 ms |
10764 KB |
wrong parameter |
4 |
Incorrect |
2 ms |
4584 KB |
wrong parameter |
5 |
Incorrect |
61 ms |
10764 KB |
wrong parameter |
6 |
Incorrect |
80 ms |
11624 KB |
wrong parameter |
7 |
Incorrect |
88 ms |
11656 KB |
wrong parameter |
8 |
Incorrect |
72 ms |
11208 KB |
wrong parameter |
9 |
Incorrect |
79 ms |
11272 KB |
wrong parameter |
10 |
Incorrect |
66 ms |
11200 KB |
wrong parameter |
11 |
Incorrect |
63 ms |
11428 KB |
wrong parameter |
12 |
Incorrect |
60 ms |
11420 KB |
wrong parameter |
13 |
Incorrect |
116 ms |
11724 KB |
wrong parameter |
14 |
Incorrect |
63 ms |
11392 KB |
wrong parameter |
15 |
Incorrect |
73 ms |
11432 KB |
wrong parameter |
16 |
Incorrect |
96 ms |
11688 KB |
wrong parameter |
17 |
Incorrect |
99 ms |
11580 KB |
wrong parameter |
18 |
Incorrect |
102 ms |
11724 KB |
wrong parameter |
19 |
Incorrect |
77 ms |
11528 KB |
wrong parameter |
20 |
Incorrect |
125 ms |
11740 KB |
wrong parameter |
21 |
Incorrect |
130 ms |
11872 KB |
wrong parameter |
22 |
Incorrect |
82 ms |
11732 KB |
wrong parameter |
23 |
Incorrect |
113 ms |
11980 KB |
wrong parameter |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
278 ms |
13396 KB |
wrong parameter |
2 |
Incorrect |
2 ms |
4584 KB |
wrong parameter |
3 |
Incorrect |
69 ms |
10764 KB |
wrong parameter |
4 |
Incorrect |
2 ms |
4584 KB |
wrong parameter |
5 |
Incorrect |
61 ms |
10764 KB |
wrong parameter |
6 |
Incorrect |
80 ms |
11624 KB |
wrong parameter |
7 |
Incorrect |
88 ms |
11656 KB |
wrong parameter |
8 |
Incorrect |
72 ms |
11208 KB |
wrong parameter |
9 |
Incorrect |
79 ms |
11272 KB |
wrong parameter |
10 |
Incorrect |
66 ms |
11200 KB |
wrong parameter |
11 |
Incorrect |
63 ms |
11428 KB |
wrong parameter |
12 |
Incorrect |
60 ms |
11420 KB |
wrong parameter |
13 |
Incorrect |
116 ms |
11724 KB |
wrong parameter |
14 |
Incorrect |
63 ms |
11392 KB |
wrong parameter |
15 |
Incorrect |
73 ms |
11432 KB |
wrong parameter |
16 |
Incorrect |
96 ms |
11688 KB |
wrong parameter |
17 |
Incorrect |
99 ms |
11580 KB |
wrong parameter |
18 |
Incorrect |
102 ms |
11724 KB |
wrong parameter |
19 |
Incorrect |
77 ms |
11528 KB |
wrong parameter |
20 |
Incorrect |
125 ms |
11740 KB |
wrong parameter |
21 |
Incorrect |
130 ms |
11872 KB |
wrong parameter |
22 |
Incorrect |
82 ms |
11732 KB |
wrong parameter |
23 |
Incorrect |
113 ms |
11980 KB |
wrong parameter |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
278 ms |
13396 KB |
wrong parameter |
2 |
Incorrect |
2 ms |
4584 KB |
wrong parameter |
3 |
Incorrect |
69 ms |
10764 KB |
wrong parameter |
4 |
Incorrect |
2 ms |
4584 KB |
wrong parameter |
5 |
Incorrect |
61 ms |
10764 KB |
wrong parameter |
6 |
Incorrect |
80 ms |
11624 KB |
wrong parameter |
7 |
Incorrect |
88 ms |
11656 KB |
wrong parameter |
8 |
Incorrect |
72 ms |
11208 KB |
wrong parameter |
9 |
Incorrect |
79 ms |
11272 KB |
wrong parameter |
10 |
Incorrect |
66 ms |
11200 KB |
wrong parameter |
11 |
Incorrect |
63 ms |
11428 KB |
wrong parameter |
12 |
Incorrect |
60 ms |
11420 KB |
wrong parameter |
13 |
Incorrect |
116 ms |
11724 KB |
wrong parameter |
14 |
Incorrect |
63 ms |
11392 KB |
wrong parameter |
15 |
Incorrect |
73 ms |
11432 KB |
wrong parameter |
16 |
Incorrect |
96 ms |
11688 KB |
wrong parameter |
17 |
Incorrect |
99 ms |
11580 KB |
wrong parameter |
18 |
Incorrect |
102 ms |
11724 KB |
wrong parameter |
19 |
Incorrect |
77 ms |
11528 KB |
wrong parameter |
20 |
Incorrect |
125 ms |
11740 KB |
wrong parameter |
21 |
Incorrect |
130 ms |
11872 KB |
wrong parameter |
22 |
Incorrect |
82 ms |
11732 KB |
wrong parameter |
23 |
Incorrect |
113 ms |
11980 KB |
wrong parameter |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
278 ms |
13396 KB |
wrong parameter |
2 |
Incorrect |
2 ms |
4584 KB |
wrong parameter |
3 |
Incorrect |
69 ms |
10764 KB |
wrong parameter |
4 |
Incorrect |
2 ms |
4584 KB |
wrong parameter |
5 |
Incorrect |
61 ms |
10764 KB |
wrong parameter |
6 |
Incorrect |
80 ms |
11624 KB |
wrong parameter |
7 |
Incorrect |
88 ms |
11656 KB |
wrong parameter |
8 |
Incorrect |
72 ms |
11208 KB |
wrong parameter |
9 |
Incorrect |
79 ms |
11272 KB |
wrong parameter |
10 |
Incorrect |
66 ms |
11200 KB |
wrong parameter |
11 |
Incorrect |
63 ms |
11428 KB |
wrong parameter |
12 |
Incorrect |
60 ms |
11420 KB |
wrong parameter |
13 |
Incorrect |
116 ms |
11724 KB |
wrong parameter |
14 |
Incorrect |
63 ms |
11392 KB |
wrong parameter |
15 |
Incorrect |
73 ms |
11432 KB |
wrong parameter |
16 |
Incorrect |
96 ms |
11688 KB |
wrong parameter |
17 |
Incorrect |
99 ms |
11580 KB |
wrong parameter |
18 |
Incorrect |
102 ms |
11724 KB |
wrong parameter |
19 |
Incorrect |
77 ms |
11528 KB |
wrong parameter |
20 |
Incorrect |
125 ms |
11740 KB |
wrong parameter |
21 |
Incorrect |
130 ms |
11872 KB |
wrong parameter |
22 |
Incorrect |
82 ms |
11732 KB |
wrong parameter |
23 |
Incorrect |
113 ms |
11980 KB |
wrong parameter |