#include <bits/stdc++.h>
#include "grader.h"
#include "encoder.h"
#define newl "\n"
#define ll int
#define pb push_back
#define f first
#define s second
using namespace std;
vector <ll> gr[1005];
vector <pair <ll, ll>> bfs(ll xx)
{
ll cnt = 0;
vector <pair <ll, ll>> ret;
queue <ll> q;
unordered_map <ll, bool> vis;
q.push(xx);
ret.pb({xx, 0});
vis[xx] = true;
while (q.size())
{
ll x = q.front();
q.pop();
cnt++;
for (auto v : gr[x])
{
if (!vis[v])
{
q.push(v);
ret.pb({v, cnt});
vis[v] = true;
}
}
}
return ret;
}
void encode(ll n, ll h, ll p, ll a[], ll b[])
{
for (ll i = 0; i < p; i++)
{
gr[a[i]].pb(b[i]);
gr[b[i]].pb(a[i]);
}
for (ll i = 0; i < h; i++)
{
vector <pair <ll, ll>> vec = bfs(i);
sort(vec.begin(), vec.end());
//cout << "HUB: " << i << " ";
for (auto v : vec)
{
//cout << "City: " << v.f << " Dist: " << v.s << " ";
for (ll b = 0; b < 10; b++)
{
ll bit = (1 << b) & v.s;
encode_bit(bit);
}
}
//cout << newl;
}
}
/*int main()
{
ll a[] = {0, 0, 0, 0, 1, 1, 1};
ll b[] = {1, 2, 3, 4, 2, 3, 4};
ll n = 5, h = 3, p = 7;
encode(n, h, p, a, b);
}*/
#include <bits/stdc++.h>
#include "grader.h"
#include "encoder.h"
#define ll int
#define pb push_back
#define f first
#define s second
using namespace std;
void decode(ll n, ll h)
{
for (ll i = 0; i < h; i++)
{
for (ll j = 0; j < n; j++)
{
ll d = 0;
ll b = decode_bit();
d += (1 << b);
hops(i, j, d);
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
159 ms |
5596 KB |
encode_bit(b) wrong parameter |
2 |
Incorrect |
0 ms |
644 KB |
encode_bit(b) wrong parameter |
3 |
Incorrect |
5 ms |
904 KB |
encode_bit(b) wrong parameter |
4 |
Incorrect |
1 ms |
636 KB |
encode_bit(b) wrong parameter |
5 |
Incorrect |
5 ms |
1020 KB |
encode_bit(b) wrong parameter |
6 |
Incorrect |
6 ms |
1024 KB |
encode_bit(b) wrong parameter |
7 |
Incorrect |
23 ms |
1308 KB |
encode_bit(b) wrong parameter |
8 |
Incorrect |
6 ms |
764 KB |
encode_bit(b) wrong parameter |
9 |
Incorrect |
4 ms |
892 KB |
encode_bit(b) wrong parameter |
10 |
Incorrect |
8 ms |
932 KB |
encode_bit(b) wrong parameter |
11 |
Incorrect |
8 ms |
1016 KB |
encode_bit(b) wrong parameter |
12 |
Incorrect |
4 ms |
848 KB |
encode_bit(b) wrong parameter |
13 |
Incorrect |
27 ms |
1504 KB |
encode_bit(b) wrong parameter |
14 |
Incorrect |
4 ms |
920 KB |
encode_bit(b) wrong parameter |
15 |
Incorrect |
7 ms |
900 KB |
encode_bit(b) wrong parameter |
16 |
Incorrect |
23 ms |
1324 KB |
encode_bit(b) wrong parameter |
17 |
Incorrect |
19 ms |
1320 KB |
encode_bit(b) wrong parameter |
18 |
Incorrect |
32 ms |
1528 KB |
encode_bit(b) wrong parameter |
19 |
Incorrect |
16 ms |
1148 KB |
encode_bit(b) wrong parameter |
20 |
Incorrect |
35 ms |
1736 KB |
encode_bit(b) wrong parameter |
21 |
Incorrect |
37 ms |
2016 KB |
encode_bit(b) wrong parameter |
22 |
Incorrect |
26 ms |
1516 KB |
encode_bit(b) wrong parameter |
23 |
Incorrect |
72 ms |
2296 KB |
encode_bit(b) wrong parameter |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
159 ms |
5596 KB |
encode_bit(b) wrong parameter |
2 |
Incorrect |
0 ms |
644 KB |
encode_bit(b) wrong parameter |
3 |
Incorrect |
5 ms |
904 KB |
encode_bit(b) wrong parameter |
4 |
Incorrect |
1 ms |
636 KB |
encode_bit(b) wrong parameter |
5 |
Incorrect |
5 ms |
1020 KB |
encode_bit(b) wrong parameter |
6 |
Incorrect |
6 ms |
1024 KB |
encode_bit(b) wrong parameter |
7 |
Incorrect |
23 ms |
1308 KB |
encode_bit(b) wrong parameter |
8 |
Incorrect |
6 ms |
764 KB |
encode_bit(b) wrong parameter |
9 |
Incorrect |
4 ms |
892 KB |
encode_bit(b) wrong parameter |
10 |
Incorrect |
8 ms |
932 KB |
encode_bit(b) wrong parameter |
11 |
Incorrect |
8 ms |
1016 KB |
encode_bit(b) wrong parameter |
12 |
Incorrect |
4 ms |
848 KB |
encode_bit(b) wrong parameter |
13 |
Incorrect |
27 ms |
1504 KB |
encode_bit(b) wrong parameter |
14 |
Incorrect |
4 ms |
920 KB |
encode_bit(b) wrong parameter |
15 |
Incorrect |
7 ms |
900 KB |
encode_bit(b) wrong parameter |
16 |
Incorrect |
23 ms |
1324 KB |
encode_bit(b) wrong parameter |
17 |
Incorrect |
19 ms |
1320 KB |
encode_bit(b) wrong parameter |
18 |
Incorrect |
32 ms |
1528 KB |
encode_bit(b) wrong parameter |
19 |
Incorrect |
16 ms |
1148 KB |
encode_bit(b) wrong parameter |
20 |
Incorrect |
35 ms |
1736 KB |
encode_bit(b) wrong parameter |
21 |
Incorrect |
37 ms |
2016 KB |
encode_bit(b) wrong parameter |
22 |
Incorrect |
26 ms |
1516 KB |
encode_bit(b) wrong parameter |
23 |
Incorrect |
72 ms |
2296 KB |
encode_bit(b) wrong parameter |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
159 ms |
5596 KB |
encode_bit(b) wrong parameter |
2 |
Incorrect |
0 ms |
644 KB |
encode_bit(b) wrong parameter |
3 |
Incorrect |
5 ms |
904 KB |
encode_bit(b) wrong parameter |
4 |
Incorrect |
1 ms |
636 KB |
encode_bit(b) wrong parameter |
5 |
Incorrect |
5 ms |
1020 KB |
encode_bit(b) wrong parameter |
6 |
Incorrect |
6 ms |
1024 KB |
encode_bit(b) wrong parameter |
7 |
Incorrect |
23 ms |
1308 KB |
encode_bit(b) wrong parameter |
8 |
Incorrect |
6 ms |
764 KB |
encode_bit(b) wrong parameter |
9 |
Incorrect |
4 ms |
892 KB |
encode_bit(b) wrong parameter |
10 |
Incorrect |
8 ms |
932 KB |
encode_bit(b) wrong parameter |
11 |
Incorrect |
8 ms |
1016 KB |
encode_bit(b) wrong parameter |
12 |
Incorrect |
4 ms |
848 KB |
encode_bit(b) wrong parameter |
13 |
Incorrect |
27 ms |
1504 KB |
encode_bit(b) wrong parameter |
14 |
Incorrect |
4 ms |
920 KB |
encode_bit(b) wrong parameter |
15 |
Incorrect |
7 ms |
900 KB |
encode_bit(b) wrong parameter |
16 |
Incorrect |
23 ms |
1324 KB |
encode_bit(b) wrong parameter |
17 |
Incorrect |
19 ms |
1320 KB |
encode_bit(b) wrong parameter |
18 |
Incorrect |
32 ms |
1528 KB |
encode_bit(b) wrong parameter |
19 |
Incorrect |
16 ms |
1148 KB |
encode_bit(b) wrong parameter |
20 |
Incorrect |
35 ms |
1736 KB |
encode_bit(b) wrong parameter |
21 |
Incorrect |
37 ms |
2016 KB |
encode_bit(b) wrong parameter |
22 |
Incorrect |
26 ms |
1516 KB |
encode_bit(b) wrong parameter |
23 |
Incorrect |
72 ms |
2296 KB |
encode_bit(b) wrong parameter |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
159 ms |
5596 KB |
encode_bit(b) wrong parameter |
2 |
Incorrect |
0 ms |
644 KB |
encode_bit(b) wrong parameter |
3 |
Incorrect |
5 ms |
904 KB |
encode_bit(b) wrong parameter |
4 |
Incorrect |
1 ms |
636 KB |
encode_bit(b) wrong parameter |
5 |
Incorrect |
5 ms |
1020 KB |
encode_bit(b) wrong parameter |
6 |
Incorrect |
6 ms |
1024 KB |
encode_bit(b) wrong parameter |
7 |
Incorrect |
23 ms |
1308 KB |
encode_bit(b) wrong parameter |
8 |
Incorrect |
6 ms |
764 KB |
encode_bit(b) wrong parameter |
9 |
Incorrect |
4 ms |
892 KB |
encode_bit(b) wrong parameter |
10 |
Incorrect |
8 ms |
932 KB |
encode_bit(b) wrong parameter |
11 |
Incorrect |
8 ms |
1016 KB |
encode_bit(b) wrong parameter |
12 |
Incorrect |
4 ms |
848 KB |
encode_bit(b) wrong parameter |
13 |
Incorrect |
27 ms |
1504 KB |
encode_bit(b) wrong parameter |
14 |
Incorrect |
4 ms |
920 KB |
encode_bit(b) wrong parameter |
15 |
Incorrect |
7 ms |
900 KB |
encode_bit(b) wrong parameter |
16 |
Incorrect |
23 ms |
1324 KB |
encode_bit(b) wrong parameter |
17 |
Incorrect |
19 ms |
1320 KB |
encode_bit(b) wrong parameter |
18 |
Incorrect |
32 ms |
1528 KB |
encode_bit(b) wrong parameter |
19 |
Incorrect |
16 ms |
1148 KB |
encode_bit(b) wrong parameter |
20 |
Incorrect |
35 ms |
1736 KB |
encode_bit(b) wrong parameter |
21 |
Incorrect |
37 ms |
2016 KB |
encode_bit(b) wrong parameter |
22 |
Incorrect |
26 ms |
1516 KB |
encode_bit(b) wrong parameter |
23 |
Incorrect |
72 ms |
2296 KB |
encode_bit(b) wrong parameter |