#include "grader.h"
#include "encoder.h"
#include <bits/stdc++.h>
using namespace std;
void encode(int n, int h, int m, int *v1, int *v2) {
vector<int> graph[n + 1];
for (int i = 0; i < m; ++i) {
graph[v1[i]].push_back(v2[i]);
graph[v2[i]].push_back(v1[i]);
}
for (int hub = 0; hub < h; ++hub) {
vector<int> dist(n + 1, 1000000007);
queue<int> q;
q.push(hub);
dist[hub] = 0;
while (q.size()) {
int u = q.front();
q.pop();
for (auto v : graph[u]) {
if (dist[v] > dist[u] + 1) {
q.push(v);
dist[v] = dist[u] + 1;
}
}
}
for (int u = 0; u < n; ++u) {
for (int mask = 0; mask < 10; ++mask) {
if (dist[u] & (1<<mask)) {
encode_bit(1);
}
else {
encode_bit(0);
}
}
}
}
return;
}
#include "grader.h"
#include "decoder.h"
#include <bits/stdc++.h>
using namespace std;
void decode(int n, int h) {
for (int hub = 0; hub < h; ++hub) {
for (int u = 0; u < n; ++u) {
int dist = 0;
for (int i = 0; i < 10; ++i) {
int mask = decode_bit();
if (mask) {
dist += 1 << i;
}
}
hops(hub, u, dist);
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
256 ms |
12252 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
2 ms |
4612 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
70 ms |
7312 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
2 ms |
4604 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
57 ms |
7476 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
78 ms |
7780 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
91 ms |
8224 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
65 ms |
7456 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
88 ms |
7576 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
80 ms |
7576 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
71 ms |
7808 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
70 ms |
7556 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
86 ms |
8220 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
69 ms |
7584 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
69 ms |
7660 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
96 ms |
8080 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
84 ms |
8056 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
89 ms |
8416 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
80 ms |
7928 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
99 ms |
8668 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
104 ms |
8740 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
80 ms |
8252 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
117 ms |
9060 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
256 ms |
12252 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
2 ms |
4612 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
70 ms |
7312 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
2 ms |
4604 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
57 ms |
7476 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
78 ms |
7780 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
91 ms |
8224 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
65 ms |
7456 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
88 ms |
7576 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
80 ms |
7576 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
71 ms |
7808 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
70 ms |
7556 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
86 ms |
8220 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
69 ms |
7584 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
69 ms |
7660 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
96 ms |
8080 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
84 ms |
8056 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
89 ms |
8416 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
80 ms |
7928 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
99 ms |
8668 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
104 ms |
8740 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
80 ms |
8252 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
117 ms |
9060 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
256 ms |
12252 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
2 ms |
4612 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
70 ms |
7312 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
2 ms |
4604 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
57 ms |
7476 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
78 ms |
7780 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
91 ms |
8224 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
65 ms |
7456 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
88 ms |
7576 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
80 ms |
7576 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
71 ms |
7808 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
70 ms |
7556 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
86 ms |
8220 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
69 ms |
7584 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
69 ms |
7660 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
96 ms |
8080 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
84 ms |
8056 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
89 ms |
8416 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
80 ms |
7928 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
99 ms |
8668 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
104 ms |
8740 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
80 ms |
8252 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
117 ms |
9060 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
256 ms |
12252 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
2 ms |
4612 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
70 ms |
7312 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
2 ms |
4604 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
57 ms |
7476 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
78 ms |
7780 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
91 ms |
8224 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
65 ms |
7456 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
88 ms |
7576 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
80 ms |
7576 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
71 ms |
7808 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
70 ms |
7556 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
86 ms |
8220 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
69 ms |
7584 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
69 ms |
7660 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
96 ms |
8080 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
84 ms |
8056 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
89 ms |
8416 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
80 ms |
7928 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
99 ms |
8668 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
104 ms |
8740 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
80 ms |
8252 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
117 ms |
9060 KB |
Output is partially correct - 360000 call(s) of encode_bit() |