#include "encoder.h"
#include "grader.h"
#include "vector"
#include "queue"
using namespace std;
vector <int> grafo[1100];
int dist[1100][1100];
void encode(int n, int h, int p, int *v1, int *v2){
for(int i=0; i<n; i++) grafo[i].clear();
for(int i=0; i<p; i++){
grafo[v1[i]].push_back(v2[i]);
grafo[v2[i]].push_back(v1[i]);
}
for(int i=0; i<h; i++){
for(int j=0; j<n; j++){
dist[i][j] = 0x3f3f3f3f;
}
queue<int> q;
q.push(i);
dist[i][i] = 0;
while(!q.empty()){
int u = q.front();
q.pop();
for(auto v : grafo[u]){
if (dist[i][u] + 1 < dist[i][v]){
dist[i][v] = dist[i][u] + 1;
q.push(v);
}
}
}
}
for(int i=0; i<h; i++){
for(int j=0; j<n; j++){
for(int k=0; k<10; k++){
encode_bit(((dist[i][j]&(1<<k))>0));
}
}
}
}
#include "decoder.h"
#include "grader.h"
void decode(int n, int h) {
for(int i=0; i<h; i++){
for (int j=0; j<n; j++){
int sum = 0;
for(int k=0; k<10; k++){
sum += (1<<k) * decode_bit();
}
hops(i, j, sum);
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
302 ms |
13808 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
12 ms |
4672 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
87 ms |
7392 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
11 ms |
4672 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
93 ms |
7744 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
104 ms |
8052 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
116 ms |
8268 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
98 ms |
7616 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
112 ms |
7872 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
98 ms |
7748 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
107 ms |
7876 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
102 ms |
7744 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
126 ms |
8528 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
104 ms |
7744 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
107 ms |
7876 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
124 ms |
8388 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
120 ms |
8256 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
124 ms |
8532 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
105 ms |
8196 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
134 ms |
8900 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
148 ms |
8816 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
129 ms |
8752 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
147 ms |
9376 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
302 ms |
13808 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
12 ms |
4672 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
87 ms |
7392 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
11 ms |
4672 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
93 ms |
7744 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
104 ms |
8052 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
116 ms |
8268 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
98 ms |
7616 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
112 ms |
7872 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
98 ms |
7748 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
107 ms |
7876 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
102 ms |
7744 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
126 ms |
8528 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
104 ms |
7744 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
107 ms |
7876 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
124 ms |
8388 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
120 ms |
8256 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
124 ms |
8532 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
105 ms |
8196 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
134 ms |
8900 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
148 ms |
8816 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
129 ms |
8752 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
147 ms |
9376 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
302 ms |
13808 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
12 ms |
4672 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
87 ms |
7392 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
11 ms |
4672 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
93 ms |
7744 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
104 ms |
8052 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
116 ms |
8268 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
98 ms |
7616 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
112 ms |
7872 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
98 ms |
7748 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
107 ms |
7876 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
102 ms |
7744 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
126 ms |
8528 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
104 ms |
7744 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
107 ms |
7876 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
124 ms |
8388 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
120 ms |
8256 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
124 ms |
8532 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
105 ms |
8196 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
134 ms |
8900 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
148 ms |
8816 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
129 ms |
8752 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
147 ms |
9376 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
302 ms |
13808 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
12 ms |
4672 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
87 ms |
7392 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
11 ms |
4672 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
93 ms |
7744 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
104 ms |
8052 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
116 ms |
8268 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
98 ms |
7616 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
112 ms |
7872 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
98 ms |
7748 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
107 ms |
7876 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
102 ms |
7744 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
126 ms |
8528 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
104 ms |
7744 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
107 ms |
7876 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
124 ms |
8388 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
120 ms |
8256 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
124 ms |
8532 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
105 ms |
8196 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
134 ms |
8900 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
148 ms |
8816 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
129 ms |
8752 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
147 ms |
9376 KB |
Output is partially correct - 360000 call(s) of encode_bit() |