#include "grader.h"
#include "encoder.h"
#include <bits/stdc++.h>
using namespace std;
void encode(int nv, int nh, int ne, int *v1, int *v2) {
vector<vector<int>> g(nv);
for (int i = 0; i < ne; i++) {
g[v1[i]].push_back(v2[i]);
g[v2[i]].push_back(v1[i]);
}
for (int h = 0; h < nh; h++) {
vector<int> dist(nv, -1);
dist[h] = 0;
vector<int> que(1, h);
for (int b = 0; b < (int) que.size(); b++) {
int i = que[b];
for (int j : g[i]) {
if (dist[j] == -1) {
dist[j] = dist[i] + 1;
que.push_back(j);
}
}
}
for (int i = 0; i < nv; i++) {
for (int b = 0; b < 10; b++) {
if (dist[i] >> b & 1) {
encode_bit(1);
} else {
encode_bit(0);
}
}
}
}
return;
}
#include "grader.h"
#include "decoder.h"
#include <bits/stdc++.h>
using namespace std;
void decode(int nv, int nh) {
for (int h = 0; h < nh; h++) {
for (int i = 0; i < nv; i++) {
int d = 0;
for (int b = 0; b < 10; b++) {
if (decode_bit() == 1) {
d += (1 << b);
}
}
hops(h, i, d);
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
155 ms |
12712 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
3 ms |
4620 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
37 ms |
7612 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
1 ms |
4632 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
46 ms |
7784 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
40 ms |
8152 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
50 ms |
8368 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
41 ms |
7512 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
46 ms |
7880 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
43 ms |
7776 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
48 ms |
7772 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
44 ms |
7556 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
62 ms |
8384 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
46 ms |
7852 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
45 ms |
7932 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
54 ms |
8204 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
55 ms |
8112 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
61 ms |
8700 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
64 ms |
8428 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
72 ms |
8872 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
84 ms |
9008 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
65 ms |
8160 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
78 ms |
9248 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
155 ms |
12712 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
3 ms |
4620 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
37 ms |
7612 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
1 ms |
4632 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
46 ms |
7784 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
40 ms |
8152 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
50 ms |
8368 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
41 ms |
7512 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
46 ms |
7880 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
43 ms |
7776 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
48 ms |
7772 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
44 ms |
7556 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
62 ms |
8384 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
46 ms |
7852 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
45 ms |
7932 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
54 ms |
8204 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
55 ms |
8112 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
61 ms |
8700 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
64 ms |
8428 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
72 ms |
8872 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
84 ms |
9008 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
65 ms |
8160 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
78 ms |
9248 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
155 ms |
12712 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
3 ms |
4620 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
37 ms |
7612 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
1 ms |
4632 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
46 ms |
7784 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
40 ms |
8152 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
50 ms |
8368 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
41 ms |
7512 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
46 ms |
7880 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
43 ms |
7776 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
48 ms |
7772 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
44 ms |
7556 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
62 ms |
8384 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
46 ms |
7852 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
45 ms |
7932 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
54 ms |
8204 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
55 ms |
8112 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
61 ms |
8700 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
64 ms |
8428 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
72 ms |
8872 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
84 ms |
9008 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
65 ms |
8160 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
78 ms |
9248 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
155 ms |
12712 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
3 ms |
4620 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
37 ms |
7612 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
1 ms |
4632 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
46 ms |
7784 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
40 ms |
8152 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
50 ms |
8368 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
41 ms |
7512 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
46 ms |
7880 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
43 ms |
7776 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
48 ms |
7772 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
44 ms |
7556 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
62 ms |
8384 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
46 ms |
7852 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
45 ms |
7932 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
54 ms |
8204 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
55 ms |
8112 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
61 ms |
8700 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
64 ms |
8428 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
72 ms |
8872 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
84 ms |
9008 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
65 ms |
8160 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
78 ms |
9248 KB |
Output is partially correct - 360000 call(s) of encode_bit() |