#include "bits/stdc++.h"
using namespace std;
#include "grader.h"
#include "encoder.h"
void encode(int n, int h, int p, int a[], int b[]) {
vector<int> v[n];
for(int i = 0; i < p; i++) {
v[a[i]].push_back(b[i]);
v[b[i]].push_back(a[i]);
}
int vis[n];
for(int i = n - 1; i >= 0; i--) {
for(int j = 0; j < n; j++)
vis[j] = 1e9;
set<pair<int, int>> s;
s.insert({0, i});
while(s.size()) {
pair<int, int> p = *s.begin();
s.erase(s.begin());
int x = p.second;
int d = p.first;
if(d > vis[x])
continue;
vis[x] = d;
for(int j : v[x]) {
if(d + (j < h) < vis[j]) {
vis[j] = d + (j < h);
s.insert({d + (j < h), j});
}
}
}
for(int j = i; j >= 0; j--) {
for(int bit = 0; bit < 10; bit++)
encode_bit((vis[j] & (1 << bit)) > 0);
}
}
return;
}
#include "bits/stdc++.h"
using namespace std;
#include "grader.h"
#include "encoder.h"
void decode(int n, int h) {
for(int i = n - 1; i >= 0; i--) {
for(int j = i; j >= 0; j--) {
int d = 0;
for(int bit = 0; bit < 10; bit++) {
if(decode_bit())
d += (1 << bit);
}
if(j >= h)
continue;
hops(j, i, d);
if(i < h && i != j)
hops(i, j, d);
}
}
return;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1583 ms |
49112 KB |
Output isn't correct |
2 |
Correct |
2 ms |
4604 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Incorrect |
867 ms |
36616 KB |
Output isn't correct |
4 |
Correct |
2 ms |
4612 KB |
Output is correct - 150 call(s) of encode_bit() |
5 |
Incorrect |
802 ms |
36672 KB |
Output isn't correct |
6 |
Incorrect |
978 ms |
44276 KB |
Output isn't correct |
7 |
Incorrect |
1078 ms |
44588 KB |
Output isn't correct |
8 |
Incorrect |
869 ms |
40952 KB |
Output isn't correct |
9 |
Incorrect |
902 ms |
43940 KB |
Output isn't correct |
10 |
Incorrect |
891 ms |
43956 KB |
Output isn't correct |
11 |
Incorrect |
976 ms |
44248 KB |
Output isn't correct |
12 |
Incorrect |
921 ms |
44060 KB |
Output isn't correct |
13 |
Incorrect |
1057 ms |
44572 KB |
Output isn't correct |
14 |
Incorrect |
998 ms |
43964 KB |
Output isn't correct |
15 |
Incorrect |
1001 ms |
44128 KB |
Output isn't correct |
16 |
Incorrect |
1006 ms |
44552 KB |
Output isn't correct |
17 |
Incorrect |
944 ms |
44596 KB |
Output isn't correct |
18 |
Incorrect |
1055 ms |
44740 KB |
Output isn't correct |
19 |
Incorrect |
1022 ms |
44412 KB |
Output isn't correct |
20 |
Incorrect |
1068 ms |
45068 KB |
Output isn't correct |
21 |
Incorrect |
1192 ms |
45260 KB |
Output isn't correct |
22 |
Incorrect |
1070 ms |
44652 KB |
Output isn't correct |
23 |
Incorrect |
1233 ms |
45620 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1583 ms |
49112 KB |
Output isn't correct |
2 |
Correct |
2 ms |
4604 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Incorrect |
867 ms |
36616 KB |
Output isn't correct |
4 |
Correct |
2 ms |
4612 KB |
Output is correct - 150 call(s) of encode_bit() |
5 |
Incorrect |
802 ms |
36672 KB |
Output isn't correct |
6 |
Incorrect |
978 ms |
44276 KB |
Output isn't correct |
7 |
Incorrect |
1078 ms |
44588 KB |
Output isn't correct |
8 |
Incorrect |
869 ms |
40952 KB |
Output isn't correct |
9 |
Incorrect |
902 ms |
43940 KB |
Output isn't correct |
10 |
Incorrect |
891 ms |
43956 KB |
Output isn't correct |
11 |
Incorrect |
976 ms |
44248 KB |
Output isn't correct |
12 |
Incorrect |
921 ms |
44060 KB |
Output isn't correct |
13 |
Incorrect |
1057 ms |
44572 KB |
Output isn't correct |
14 |
Incorrect |
998 ms |
43964 KB |
Output isn't correct |
15 |
Incorrect |
1001 ms |
44128 KB |
Output isn't correct |
16 |
Incorrect |
1006 ms |
44552 KB |
Output isn't correct |
17 |
Incorrect |
944 ms |
44596 KB |
Output isn't correct |
18 |
Incorrect |
1055 ms |
44740 KB |
Output isn't correct |
19 |
Incorrect |
1022 ms |
44412 KB |
Output isn't correct |
20 |
Incorrect |
1068 ms |
45068 KB |
Output isn't correct |
21 |
Incorrect |
1192 ms |
45260 KB |
Output isn't correct |
22 |
Incorrect |
1070 ms |
44652 KB |
Output isn't correct |
23 |
Incorrect |
1233 ms |
45620 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1583 ms |
49112 KB |
Output isn't correct |
2 |
Correct |
2 ms |
4604 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Incorrect |
867 ms |
36616 KB |
Output isn't correct |
4 |
Correct |
2 ms |
4612 KB |
Output is correct - 150 call(s) of encode_bit() |
5 |
Incorrect |
802 ms |
36672 KB |
Output isn't correct |
6 |
Incorrect |
978 ms |
44276 KB |
Output isn't correct |
7 |
Incorrect |
1078 ms |
44588 KB |
Output isn't correct |
8 |
Incorrect |
869 ms |
40952 KB |
Output isn't correct |
9 |
Incorrect |
902 ms |
43940 KB |
Output isn't correct |
10 |
Incorrect |
891 ms |
43956 KB |
Output isn't correct |
11 |
Incorrect |
976 ms |
44248 KB |
Output isn't correct |
12 |
Incorrect |
921 ms |
44060 KB |
Output isn't correct |
13 |
Incorrect |
1057 ms |
44572 KB |
Output isn't correct |
14 |
Incorrect |
998 ms |
43964 KB |
Output isn't correct |
15 |
Incorrect |
1001 ms |
44128 KB |
Output isn't correct |
16 |
Incorrect |
1006 ms |
44552 KB |
Output isn't correct |
17 |
Incorrect |
944 ms |
44596 KB |
Output isn't correct |
18 |
Incorrect |
1055 ms |
44740 KB |
Output isn't correct |
19 |
Incorrect |
1022 ms |
44412 KB |
Output isn't correct |
20 |
Incorrect |
1068 ms |
45068 KB |
Output isn't correct |
21 |
Incorrect |
1192 ms |
45260 KB |
Output isn't correct |
22 |
Incorrect |
1070 ms |
44652 KB |
Output isn't correct |
23 |
Incorrect |
1233 ms |
45620 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1583 ms |
49112 KB |
Output isn't correct |
2 |
Correct |
2 ms |
4604 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Incorrect |
867 ms |
36616 KB |
Output isn't correct |
4 |
Correct |
2 ms |
4612 KB |
Output is correct - 150 call(s) of encode_bit() |
5 |
Incorrect |
802 ms |
36672 KB |
Output isn't correct |
6 |
Incorrect |
978 ms |
44276 KB |
Output isn't correct |
7 |
Incorrect |
1078 ms |
44588 KB |
Output isn't correct |
8 |
Incorrect |
869 ms |
40952 KB |
Output isn't correct |
9 |
Incorrect |
902 ms |
43940 KB |
Output isn't correct |
10 |
Incorrect |
891 ms |
43956 KB |
Output isn't correct |
11 |
Incorrect |
976 ms |
44248 KB |
Output isn't correct |
12 |
Incorrect |
921 ms |
44060 KB |
Output isn't correct |
13 |
Incorrect |
1057 ms |
44572 KB |
Output isn't correct |
14 |
Incorrect |
998 ms |
43964 KB |
Output isn't correct |
15 |
Incorrect |
1001 ms |
44128 KB |
Output isn't correct |
16 |
Incorrect |
1006 ms |
44552 KB |
Output isn't correct |
17 |
Incorrect |
944 ms |
44596 KB |
Output isn't correct |
18 |
Incorrect |
1055 ms |
44740 KB |
Output isn't correct |
19 |
Incorrect |
1022 ms |
44412 KB |
Output isn't correct |
20 |
Incorrect |
1068 ms |
45068 KB |
Output isn't correct |
21 |
Incorrect |
1192 ms |
45260 KB |
Output isn't correct |
22 |
Incorrect |
1070 ms |
44652 KB |
Output isn't correct |
23 |
Incorrect |
1233 ms |
45620 KB |
Output isn't correct |