#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.back();
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 < 1000; i++)
{
if (gr[i].size()) gr[i].clear();
}
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;
//cout << " Dist: ";
//cout << v.s;
for (ll b = 0; b < 10; b++)
{
bool bit = (1 << b) & v.s;
//cout << bit;
encode_bit(bit);
}
//cout << " ";
}
//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;
for (ll bit = 0; bit < 10; bit++)
{
bool b = decode_bit();
if (b) d += (1 << bit);
}
hops(i, j, d);
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
312 ms |
12480 KB |
too many decode_bit() calls |
2 |
Correct |
3 ms |
4712 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Incorrect |
51 ms |
6312 KB |
too many decode_bit() calls |
4 |
Correct |
3 ms |
4612 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Incorrect |
61 ms |
7132 KB |
too many decode_bit() calls |
6 |
Incorrect |
78 ms |
7452 KB |
too many decode_bit() calls |
7 |
Incorrect |
91 ms |
8012 KB |
too many decode_bit() calls |
8 |
Incorrect |
51 ms |
6432 KB |
too many decode_bit() calls |
9 |
Incorrect |
13 ms |
5096 KB |
too many decode_bit() calls |
10 |
Incorrect |
13 ms |
5108 KB |
too many decode_bit() calls |
11 |
Incorrect |
17 ms |
5244 KB |
too many decode_bit() calls |
12 |
Incorrect |
45 ms |
6248 KB |
too many decode_bit() calls |
13 |
Incorrect |
58 ms |
7008 KB |
too many decode_bit() calls |
14 |
Incorrect |
34 ms |
6096 KB |
too many decode_bit() calls |
15 |
Incorrect |
33 ms |
5912 KB |
too many decode_bit() calls |
16 |
Incorrect |
59 ms |
6124 KB |
too many decode_bit() calls |
17 |
Incorrect |
41 ms |
6212 KB |
too many decode_bit() calls |
18 |
Incorrect |
40 ms |
6268 KB |
too many decode_bit() calls |
19 |
Incorrect |
28 ms |
5696 KB |
too many decode_bit() calls |
20 |
Incorrect |
55 ms |
6764 KB |
too many decode_bit() calls |
21 |
Incorrect |
50 ms |
6452 KB |
too many decode_bit() calls |
22 |
Incorrect |
47 ms |
6188 KB |
too many decode_bit() calls |
23 |
Incorrect |
64 ms |
7220 KB |
too many decode_bit() calls |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
312 ms |
12480 KB |
too many decode_bit() calls |
2 |
Correct |
3 ms |
4712 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Incorrect |
51 ms |
6312 KB |
too many decode_bit() calls |
4 |
Correct |
3 ms |
4612 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Incorrect |
61 ms |
7132 KB |
too many decode_bit() calls |
6 |
Incorrect |
78 ms |
7452 KB |
too many decode_bit() calls |
7 |
Incorrect |
91 ms |
8012 KB |
too many decode_bit() calls |
8 |
Incorrect |
51 ms |
6432 KB |
too many decode_bit() calls |
9 |
Incorrect |
13 ms |
5096 KB |
too many decode_bit() calls |
10 |
Incorrect |
13 ms |
5108 KB |
too many decode_bit() calls |
11 |
Incorrect |
17 ms |
5244 KB |
too many decode_bit() calls |
12 |
Incorrect |
45 ms |
6248 KB |
too many decode_bit() calls |
13 |
Incorrect |
58 ms |
7008 KB |
too many decode_bit() calls |
14 |
Incorrect |
34 ms |
6096 KB |
too many decode_bit() calls |
15 |
Incorrect |
33 ms |
5912 KB |
too many decode_bit() calls |
16 |
Incorrect |
59 ms |
6124 KB |
too many decode_bit() calls |
17 |
Incorrect |
41 ms |
6212 KB |
too many decode_bit() calls |
18 |
Incorrect |
40 ms |
6268 KB |
too many decode_bit() calls |
19 |
Incorrect |
28 ms |
5696 KB |
too many decode_bit() calls |
20 |
Incorrect |
55 ms |
6764 KB |
too many decode_bit() calls |
21 |
Incorrect |
50 ms |
6452 KB |
too many decode_bit() calls |
22 |
Incorrect |
47 ms |
6188 KB |
too many decode_bit() calls |
23 |
Incorrect |
64 ms |
7220 KB |
too many decode_bit() calls |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
312 ms |
12480 KB |
too many decode_bit() calls |
2 |
Correct |
3 ms |
4712 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Incorrect |
51 ms |
6312 KB |
too many decode_bit() calls |
4 |
Correct |
3 ms |
4612 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Incorrect |
61 ms |
7132 KB |
too many decode_bit() calls |
6 |
Incorrect |
78 ms |
7452 KB |
too many decode_bit() calls |
7 |
Incorrect |
91 ms |
8012 KB |
too many decode_bit() calls |
8 |
Incorrect |
51 ms |
6432 KB |
too many decode_bit() calls |
9 |
Incorrect |
13 ms |
5096 KB |
too many decode_bit() calls |
10 |
Incorrect |
13 ms |
5108 KB |
too many decode_bit() calls |
11 |
Incorrect |
17 ms |
5244 KB |
too many decode_bit() calls |
12 |
Incorrect |
45 ms |
6248 KB |
too many decode_bit() calls |
13 |
Incorrect |
58 ms |
7008 KB |
too many decode_bit() calls |
14 |
Incorrect |
34 ms |
6096 KB |
too many decode_bit() calls |
15 |
Incorrect |
33 ms |
5912 KB |
too many decode_bit() calls |
16 |
Incorrect |
59 ms |
6124 KB |
too many decode_bit() calls |
17 |
Incorrect |
41 ms |
6212 KB |
too many decode_bit() calls |
18 |
Incorrect |
40 ms |
6268 KB |
too many decode_bit() calls |
19 |
Incorrect |
28 ms |
5696 KB |
too many decode_bit() calls |
20 |
Incorrect |
55 ms |
6764 KB |
too many decode_bit() calls |
21 |
Incorrect |
50 ms |
6452 KB |
too many decode_bit() calls |
22 |
Incorrect |
47 ms |
6188 KB |
too many decode_bit() calls |
23 |
Incorrect |
64 ms |
7220 KB |
too many decode_bit() calls |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
312 ms |
12480 KB |
too many decode_bit() calls |
2 |
Correct |
3 ms |
4712 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Incorrect |
51 ms |
6312 KB |
too many decode_bit() calls |
4 |
Correct |
3 ms |
4612 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Incorrect |
61 ms |
7132 KB |
too many decode_bit() calls |
6 |
Incorrect |
78 ms |
7452 KB |
too many decode_bit() calls |
7 |
Incorrect |
91 ms |
8012 KB |
too many decode_bit() calls |
8 |
Incorrect |
51 ms |
6432 KB |
too many decode_bit() calls |
9 |
Incorrect |
13 ms |
5096 KB |
too many decode_bit() calls |
10 |
Incorrect |
13 ms |
5108 KB |
too many decode_bit() calls |
11 |
Incorrect |
17 ms |
5244 KB |
too many decode_bit() calls |
12 |
Incorrect |
45 ms |
6248 KB |
too many decode_bit() calls |
13 |
Incorrect |
58 ms |
7008 KB |
too many decode_bit() calls |
14 |
Incorrect |
34 ms |
6096 KB |
too many decode_bit() calls |
15 |
Incorrect |
33 ms |
5912 KB |
too many decode_bit() calls |
16 |
Incorrect |
59 ms |
6124 KB |
too many decode_bit() calls |
17 |
Incorrect |
41 ms |
6212 KB |
too many decode_bit() calls |
18 |
Incorrect |
40 ms |
6268 KB |
too many decode_bit() calls |
19 |
Incorrect |
28 ms |
5696 KB |
too many decode_bit() calls |
20 |
Incorrect |
55 ms |
6764 KB |
too many decode_bit() calls |
21 |
Incorrect |
50 ms |
6452 KB |
too many decode_bit() calls |
22 |
Incorrect |
47 ms |
6188 KB |
too many decode_bit() calls |
23 |
Incorrect |
64 ms |
7220 KB |
too many decode_bit() calls |