#include "grader.h"
#include "encoder.h"
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e3 + 20;
const int maxk = 40;
vector<int> adj[maxn];
int dist[maxk][maxn];
int n, h;
void bfs(int s) {
for (int i = 1; i <= n; i++) {
dist[s][i] = -1;
}
dist[s][s] = 0;
deque<int> q;
q.push_back(s);
while (!q.empty()) {
int u = q.front();
q.pop_front();
for (auto v: adj[u]) {
if (dist[s][v] == -1) {
dist[s][v] = dist[s][u] + 1;
q.push_back(v);
}
}
}
}
void encode(int _n, int _h, int m, int *x, int *y){
n = _n;
h = _h;
for (int i = 0; i < m; i++) {
int u = x[i] + 1;
int v = y[i] + 1;
adj[u].push_back(v);
adj[v].push_back(u);
}
for (int i = 1; i <= h; i++) {
bfs(i);
}
for (int i = 1; i <= h; i++) {
for (int j = 1; j <= n; j++) {
for (int k = 0; k < 10; k++) {
encode_bit((dist[i][j] >> k) & 1);
}
}
}
}
#include "grader.h"
#include "decoder.h"
void decode(int n, int h) {
for (int i = 0; i < h; i++) {
for (int j = 0; j < n; j++) {
int dist = 0;
for (int k = 0; k < 10; k++) {
dist |= decode_bit() << k;
}
hops(i, j, dist);
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
180 ms |
12740 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
2 ms |
4604 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
63 ms |
7464 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 |
65 ms |
7544 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
75 ms |
7916 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
80 ms |
8228 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
59 ms |
7512 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
56 ms |
7724 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
73 ms |
7716 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
65 ms |
7792 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
76 ms |
7676 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
87 ms |
8340 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
75 ms |
7752 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
77 ms |
7752 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
82 ms |
8184 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
75 ms |
8056 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
95 ms |
8464 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
71 ms |
7968 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
79 ms |
8708 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
108 ms |
8836 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
83 ms |
8236 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
105 ms |
9080 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
180 ms |
12740 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
2 ms |
4604 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
63 ms |
7464 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 |
65 ms |
7544 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
75 ms |
7916 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
80 ms |
8228 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
59 ms |
7512 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
56 ms |
7724 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
73 ms |
7716 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
65 ms |
7792 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
76 ms |
7676 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
87 ms |
8340 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
75 ms |
7752 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
77 ms |
7752 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
82 ms |
8184 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
75 ms |
8056 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
95 ms |
8464 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
71 ms |
7968 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
79 ms |
8708 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
108 ms |
8836 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
83 ms |
8236 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
105 ms |
9080 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
180 ms |
12740 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
2 ms |
4604 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
63 ms |
7464 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 |
65 ms |
7544 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
75 ms |
7916 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
80 ms |
8228 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
59 ms |
7512 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
56 ms |
7724 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
73 ms |
7716 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
65 ms |
7792 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
76 ms |
7676 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
87 ms |
8340 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
75 ms |
7752 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
77 ms |
7752 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
82 ms |
8184 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
75 ms |
8056 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
95 ms |
8464 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
71 ms |
7968 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
79 ms |
8708 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
108 ms |
8836 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
83 ms |
8236 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
105 ms |
9080 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
180 ms |
12740 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
2 ms |
4604 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
63 ms |
7464 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 |
65 ms |
7544 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
75 ms |
7916 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
80 ms |
8228 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
59 ms |
7512 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
56 ms |
7724 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
73 ms |
7716 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
65 ms |
7792 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
76 ms |
7676 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
87 ms |
8340 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
75 ms |
7752 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
77 ms |
7752 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
82 ms |
8184 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
75 ms |
8056 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
95 ms |
8464 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
71 ms |
7968 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
79 ms |
8708 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
108 ms |
8836 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
83 ms |
8236 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
105 ms |
9080 KB |
Output is partially correct - 360000 call(s) of encode_bit() |