#include "grader.h"
#include "encoder.h"
#include"bits/stdc++.h"
using namespace std;
void encode(int n, int h, int p, int *v1, int *v2){
for (int i = 0 ; i < p ; i++) {
for (int k = 0 ; k < 10 ; k++) {
encode_bit(bool(v1[i] & (1 << k)));
}
for (int k = 0 ; k < 10 ; k++) {
encode_bit(bool(v2[i] & (1 << k)));
}
}
for (int i = 0 ; i < 10 ; i++) encode_bit(1);
}
#include "grader.h"
#include "decoder.h"
#include "bits/stdc++.h"
using namespace std;
void decode(int n, int h) {
auto getnum = [&]() {
int ret = 0;
for (int k = 0 ; k < 10 ; k++) {
ret |= (1 << k) * decode_bit();
}
return ret;
};
vector<int> adj[n];
while (true) {
int a = getnum();
if (__builtin_popcount(a) == 10) break;
int b = getnum();
adj[a].push_back(b);
adj[b].push_back(a);
}
for (int i = 0 ; i < h ; i++) {
int dist[n];
for (int j = 0 ; j < n ; j++) dist[j] = INT_MAX;
queue<int> q;
q.push(i);
dist[i] = 0;
while (q.size()) {
auto cur = q.front();
q.pop();
for (int j : adj[cur]) {
if (dist[j] > dist[cur] + 1) {
dist[j] = dist[cur] + 1;
q.push(j);
}
}
}
for (int j = 0 ; j < n ; j++) hops(i, j, dist[j]);
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1070 ms |
49084 KB |
Output is partially correct - 5025710 call(s) of encode_bit() |
2 |
Correct |
2 ms |
4476 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
25 ms |
5436 KB |
Output is correct - 69690 call(s) of encode_bit() |
4 |
Correct |
2 ms |
4608 KB |
Output is correct - 190 call(s) of encode_bit() |
5 |
Correct |
50 ms |
6368 KB |
Output is partially correct - 197490 call(s) of encode_bit() |
6 |
Correct |
63 ms |
6344 KB |
Output is partially correct - 197770 call(s) of encode_bit() |
7 |
Correct |
147 ms |
9816 KB |
Output is partially correct - 581830 call(s) of encode_bit() |
8 |
Correct |
16 ms |
5120 KB |
Output is correct - 37210 call(s) of encode_bit() |
9 |
Correct |
26 ms |
5384 KB |
Output is correct - 67250 call(s) of encode_bit() |
10 |
Correct |
31 ms |
5352 KB |
Output is correct - 68070 call(s) of encode_bit() |
11 |
Correct |
54 ms |
6604 KB |
Output is partially correct - 216870 call(s) of encode_bit() |
12 |
Correct |
14 ms |
4860 KB |
Output is correct - 19990 call(s) of encode_bit() |
13 |
Correct |
185 ms |
11388 KB |
Output is partially correct - 750550 call(s) of encode_bit() |
14 |
Correct |
28 ms |
5340 KB |
Output is partially correct - 82270 call(s) of encode_bit() |
15 |
Correct |
32 ms |
5860 KB |
Output is partially correct - 126970 call(s) of encode_bit() |
16 |
Correct |
146 ms |
10660 KB |
Output is partially correct - 686030 call(s) of encode_bit() |
17 |
Correct |
150 ms |
9676 KB |
Output is partially correct - 567970 call(s) of encode_bit() |
18 |
Correct |
181 ms |
11600 KB |
Output is partially correct - 773330 call(s) of encode_bit() |
19 |
Correct |
103 ms |
8092 KB |
Output is partially correct - 386730 call(s) of encode_bit() |
20 |
Correct |
229 ms |
13796 KB |
Output is partially correct - 1010850 call(s) of encode_bit() |
21 |
Correct |
278 ms |
15528 KB |
Output is partially correct - 1229530 call(s) of encode_bit() |
22 |
Correct |
160 ms |
10816 KB |
Output is partially correct - 690370 call(s) of encode_bit() |
23 |
Correct |
288 ms |
16576 KB |
Output is partially correct - 1323310 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1070 ms |
49084 KB |
Output is partially correct - 5025710 call(s) of encode_bit() |
2 |
Correct |
2 ms |
4476 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
25 ms |
5436 KB |
Output is correct - 69690 call(s) of encode_bit() |
4 |
Correct |
2 ms |
4608 KB |
Output is correct - 190 call(s) of encode_bit() |
5 |
Correct |
50 ms |
6368 KB |
Output is partially correct - 197490 call(s) of encode_bit() |
6 |
Correct |
63 ms |
6344 KB |
Output is partially correct - 197770 call(s) of encode_bit() |
7 |
Correct |
147 ms |
9816 KB |
Output is partially correct - 581830 call(s) of encode_bit() |
8 |
Correct |
16 ms |
5120 KB |
Output is correct - 37210 call(s) of encode_bit() |
9 |
Correct |
26 ms |
5384 KB |
Output is correct - 67250 call(s) of encode_bit() |
10 |
Correct |
31 ms |
5352 KB |
Output is correct - 68070 call(s) of encode_bit() |
11 |
Correct |
54 ms |
6604 KB |
Output is partially correct - 216870 call(s) of encode_bit() |
12 |
Correct |
14 ms |
4860 KB |
Output is correct - 19990 call(s) of encode_bit() |
13 |
Correct |
185 ms |
11388 KB |
Output is partially correct - 750550 call(s) of encode_bit() |
14 |
Correct |
28 ms |
5340 KB |
Output is partially correct - 82270 call(s) of encode_bit() |
15 |
Correct |
32 ms |
5860 KB |
Output is partially correct - 126970 call(s) of encode_bit() |
16 |
Correct |
146 ms |
10660 KB |
Output is partially correct - 686030 call(s) of encode_bit() |
17 |
Correct |
150 ms |
9676 KB |
Output is partially correct - 567970 call(s) of encode_bit() |
18 |
Correct |
181 ms |
11600 KB |
Output is partially correct - 773330 call(s) of encode_bit() |
19 |
Correct |
103 ms |
8092 KB |
Output is partially correct - 386730 call(s) of encode_bit() |
20 |
Correct |
229 ms |
13796 KB |
Output is partially correct - 1010850 call(s) of encode_bit() |
21 |
Correct |
278 ms |
15528 KB |
Output is partially correct - 1229530 call(s) of encode_bit() |
22 |
Correct |
160 ms |
10816 KB |
Output is partially correct - 690370 call(s) of encode_bit() |
23 |
Correct |
288 ms |
16576 KB |
Output is partially correct - 1323310 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1070 ms |
49084 KB |
Output is partially correct - 5025710 call(s) of encode_bit() |
2 |
Correct |
2 ms |
4476 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
25 ms |
5436 KB |
Output is correct - 69690 call(s) of encode_bit() |
4 |
Correct |
2 ms |
4608 KB |
Output is correct - 190 call(s) of encode_bit() |
5 |
Correct |
50 ms |
6368 KB |
Output is partially correct - 197490 call(s) of encode_bit() |
6 |
Correct |
63 ms |
6344 KB |
Output is partially correct - 197770 call(s) of encode_bit() |
7 |
Correct |
147 ms |
9816 KB |
Output is partially correct - 581830 call(s) of encode_bit() |
8 |
Correct |
16 ms |
5120 KB |
Output is correct - 37210 call(s) of encode_bit() |
9 |
Correct |
26 ms |
5384 KB |
Output is correct - 67250 call(s) of encode_bit() |
10 |
Correct |
31 ms |
5352 KB |
Output is correct - 68070 call(s) of encode_bit() |
11 |
Correct |
54 ms |
6604 KB |
Output is partially correct - 216870 call(s) of encode_bit() |
12 |
Correct |
14 ms |
4860 KB |
Output is correct - 19990 call(s) of encode_bit() |
13 |
Correct |
185 ms |
11388 KB |
Output is partially correct - 750550 call(s) of encode_bit() |
14 |
Correct |
28 ms |
5340 KB |
Output is partially correct - 82270 call(s) of encode_bit() |
15 |
Correct |
32 ms |
5860 KB |
Output is partially correct - 126970 call(s) of encode_bit() |
16 |
Correct |
146 ms |
10660 KB |
Output is partially correct - 686030 call(s) of encode_bit() |
17 |
Correct |
150 ms |
9676 KB |
Output is partially correct - 567970 call(s) of encode_bit() |
18 |
Correct |
181 ms |
11600 KB |
Output is partially correct - 773330 call(s) of encode_bit() |
19 |
Correct |
103 ms |
8092 KB |
Output is partially correct - 386730 call(s) of encode_bit() |
20 |
Correct |
229 ms |
13796 KB |
Output is partially correct - 1010850 call(s) of encode_bit() |
21 |
Correct |
278 ms |
15528 KB |
Output is partially correct - 1229530 call(s) of encode_bit() |
22 |
Correct |
160 ms |
10816 KB |
Output is partially correct - 690370 call(s) of encode_bit() |
23 |
Correct |
288 ms |
16576 KB |
Output is partially correct - 1323310 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1070 ms |
49084 KB |
Output is partially correct - 5025710 call(s) of encode_bit() |
2 |
Correct |
2 ms |
4476 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
25 ms |
5436 KB |
Output is correct - 69690 call(s) of encode_bit() |
4 |
Correct |
2 ms |
4608 KB |
Output is correct - 190 call(s) of encode_bit() |
5 |
Correct |
50 ms |
6368 KB |
Output is partially correct - 197490 call(s) of encode_bit() |
6 |
Correct |
63 ms |
6344 KB |
Output is partially correct - 197770 call(s) of encode_bit() |
7 |
Correct |
147 ms |
9816 KB |
Output is partially correct - 581830 call(s) of encode_bit() |
8 |
Correct |
16 ms |
5120 KB |
Output is correct - 37210 call(s) of encode_bit() |
9 |
Correct |
26 ms |
5384 KB |
Output is correct - 67250 call(s) of encode_bit() |
10 |
Correct |
31 ms |
5352 KB |
Output is correct - 68070 call(s) of encode_bit() |
11 |
Correct |
54 ms |
6604 KB |
Output is partially correct - 216870 call(s) of encode_bit() |
12 |
Correct |
14 ms |
4860 KB |
Output is correct - 19990 call(s) of encode_bit() |
13 |
Correct |
185 ms |
11388 KB |
Output is partially correct - 750550 call(s) of encode_bit() |
14 |
Correct |
28 ms |
5340 KB |
Output is partially correct - 82270 call(s) of encode_bit() |
15 |
Correct |
32 ms |
5860 KB |
Output is partially correct - 126970 call(s) of encode_bit() |
16 |
Correct |
146 ms |
10660 KB |
Output is partially correct - 686030 call(s) of encode_bit() |
17 |
Correct |
150 ms |
9676 KB |
Output is partially correct - 567970 call(s) of encode_bit() |
18 |
Correct |
181 ms |
11600 KB |
Output is partially correct - 773330 call(s) of encode_bit() |
19 |
Correct |
103 ms |
8092 KB |
Output is partially correct - 386730 call(s) of encode_bit() |
20 |
Correct |
229 ms |
13796 KB |
Output is partially correct - 1010850 call(s) of encode_bit() |
21 |
Correct |
278 ms |
15528 KB |
Output is partially correct - 1229530 call(s) of encode_bit() |
22 |
Correct |
160 ms |
10816 KB |
Output is partially correct - 690370 call(s) of encode_bit() |
23 |
Correct |
288 ms |
16576 KB |
Output is partially correct - 1323310 call(s) of encode_bit() |