#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;
//cout << " Dist: ";
//cout << v.s;
for (ll b = 0; b < 11; 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;
ll b = decode_bit();
if (b == 1) d += (1 << b);
hops(i, j, d);
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
320 ms |
12764 KB |
Output isn't correct |
2 |
Incorrect |
2 ms |
4604 KB |
Output isn't correct |
3 |
Incorrect |
90 ms |
7588 KB |
Output isn't correct |
4 |
Incorrect |
4 ms |
4604 KB |
Output isn't correct |
5 |
Incorrect |
92 ms |
7796 KB |
Output isn't correct |
6 |
Incorrect |
94 ms |
8072 KB |
Output isn't correct |
7 |
Incorrect |
118 ms |
8364 KB |
Output isn't correct |
8 |
Incorrect |
78 ms |
7768 KB |
Output isn't correct |
9 |
Incorrect |
82 ms |
7900 KB |
Output isn't correct |
10 |
Incorrect |
79 ms |
7896 KB |
Output isn't correct |
11 |
Incorrect |
87 ms |
8016 KB |
Output isn't correct |
12 |
Incorrect |
88 ms |
7828 KB |
Output isn't correct |
13 |
Incorrect |
117 ms |
8468 KB |
Output isn't correct |
14 |
Incorrect |
89 ms |
7892 KB |
Output isn't correct |
15 |
Incorrect |
80 ms |
7940 KB |
Output isn't correct |
16 |
Incorrect |
130 ms |
8496 KB |
Output isn't correct |
17 |
Incorrect |
110 ms |
8372 KB |
Output isn't correct |
18 |
Incorrect |
126 ms |
8684 KB |
Output isn't correct |
19 |
Incorrect |
107 ms |
8196 KB |
Output isn't correct |
20 |
Incorrect |
129 ms |
8960 KB |
Output isn't correct |
21 |
Incorrect |
135 ms |
9072 KB |
Output isn't correct |
22 |
Incorrect |
106 ms |
8548 KB |
Output isn't correct |
23 |
Incorrect |
148 ms |
9224 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
320 ms |
12764 KB |
Output isn't correct |
2 |
Incorrect |
2 ms |
4604 KB |
Output isn't correct |
3 |
Incorrect |
90 ms |
7588 KB |
Output isn't correct |
4 |
Incorrect |
4 ms |
4604 KB |
Output isn't correct |
5 |
Incorrect |
92 ms |
7796 KB |
Output isn't correct |
6 |
Incorrect |
94 ms |
8072 KB |
Output isn't correct |
7 |
Incorrect |
118 ms |
8364 KB |
Output isn't correct |
8 |
Incorrect |
78 ms |
7768 KB |
Output isn't correct |
9 |
Incorrect |
82 ms |
7900 KB |
Output isn't correct |
10 |
Incorrect |
79 ms |
7896 KB |
Output isn't correct |
11 |
Incorrect |
87 ms |
8016 KB |
Output isn't correct |
12 |
Incorrect |
88 ms |
7828 KB |
Output isn't correct |
13 |
Incorrect |
117 ms |
8468 KB |
Output isn't correct |
14 |
Incorrect |
89 ms |
7892 KB |
Output isn't correct |
15 |
Incorrect |
80 ms |
7940 KB |
Output isn't correct |
16 |
Incorrect |
130 ms |
8496 KB |
Output isn't correct |
17 |
Incorrect |
110 ms |
8372 KB |
Output isn't correct |
18 |
Incorrect |
126 ms |
8684 KB |
Output isn't correct |
19 |
Incorrect |
107 ms |
8196 KB |
Output isn't correct |
20 |
Incorrect |
129 ms |
8960 KB |
Output isn't correct |
21 |
Incorrect |
135 ms |
9072 KB |
Output isn't correct |
22 |
Incorrect |
106 ms |
8548 KB |
Output isn't correct |
23 |
Incorrect |
148 ms |
9224 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
320 ms |
12764 KB |
Output isn't correct |
2 |
Incorrect |
2 ms |
4604 KB |
Output isn't correct |
3 |
Incorrect |
90 ms |
7588 KB |
Output isn't correct |
4 |
Incorrect |
4 ms |
4604 KB |
Output isn't correct |
5 |
Incorrect |
92 ms |
7796 KB |
Output isn't correct |
6 |
Incorrect |
94 ms |
8072 KB |
Output isn't correct |
7 |
Incorrect |
118 ms |
8364 KB |
Output isn't correct |
8 |
Incorrect |
78 ms |
7768 KB |
Output isn't correct |
9 |
Incorrect |
82 ms |
7900 KB |
Output isn't correct |
10 |
Incorrect |
79 ms |
7896 KB |
Output isn't correct |
11 |
Incorrect |
87 ms |
8016 KB |
Output isn't correct |
12 |
Incorrect |
88 ms |
7828 KB |
Output isn't correct |
13 |
Incorrect |
117 ms |
8468 KB |
Output isn't correct |
14 |
Incorrect |
89 ms |
7892 KB |
Output isn't correct |
15 |
Incorrect |
80 ms |
7940 KB |
Output isn't correct |
16 |
Incorrect |
130 ms |
8496 KB |
Output isn't correct |
17 |
Incorrect |
110 ms |
8372 KB |
Output isn't correct |
18 |
Incorrect |
126 ms |
8684 KB |
Output isn't correct |
19 |
Incorrect |
107 ms |
8196 KB |
Output isn't correct |
20 |
Incorrect |
129 ms |
8960 KB |
Output isn't correct |
21 |
Incorrect |
135 ms |
9072 KB |
Output isn't correct |
22 |
Incorrect |
106 ms |
8548 KB |
Output isn't correct |
23 |
Incorrect |
148 ms |
9224 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
320 ms |
12764 KB |
Output isn't correct |
2 |
Incorrect |
2 ms |
4604 KB |
Output isn't correct |
3 |
Incorrect |
90 ms |
7588 KB |
Output isn't correct |
4 |
Incorrect |
4 ms |
4604 KB |
Output isn't correct |
5 |
Incorrect |
92 ms |
7796 KB |
Output isn't correct |
6 |
Incorrect |
94 ms |
8072 KB |
Output isn't correct |
7 |
Incorrect |
118 ms |
8364 KB |
Output isn't correct |
8 |
Incorrect |
78 ms |
7768 KB |
Output isn't correct |
9 |
Incorrect |
82 ms |
7900 KB |
Output isn't correct |
10 |
Incorrect |
79 ms |
7896 KB |
Output isn't correct |
11 |
Incorrect |
87 ms |
8016 KB |
Output isn't correct |
12 |
Incorrect |
88 ms |
7828 KB |
Output isn't correct |
13 |
Incorrect |
117 ms |
8468 KB |
Output isn't correct |
14 |
Incorrect |
89 ms |
7892 KB |
Output isn't correct |
15 |
Incorrect |
80 ms |
7940 KB |
Output isn't correct |
16 |
Incorrect |
130 ms |
8496 KB |
Output isn't correct |
17 |
Incorrect |
110 ms |
8372 KB |
Output isn't correct |
18 |
Incorrect |
126 ms |
8684 KB |
Output isn't correct |
19 |
Incorrect |
107 ms |
8196 KB |
Output isn't correct |
20 |
Incorrect |
129 ms |
8960 KB |
Output isn't correct |
21 |
Incorrect |
135 ms |
9072 KB |
Output isn't correct |
22 |
Incorrect |
106 ms |
8548 KB |
Output isn't correct |
23 |
Incorrect |
148 ms |
9224 KB |
Output isn't correct |