#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<h; 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);
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
287 ms |
9924 KB |
Output isn't correct |
2 |
Incorrect |
12 ms |
4716 KB |
wrong parameter |
3 |
Incorrect |
91 ms |
7688 KB |
Output isn't correct |
4 |
Incorrect |
12 ms |
4776 KB |
Output isn't correct |
5 |
Incorrect |
99 ms |
7616 KB |
Output isn't correct |
6 |
Incorrect |
96 ms |
7744 KB |
Output isn't correct |
7 |
Incorrect |
114 ms |
8000 KB |
Output isn't correct |
8 |
Incorrect |
97 ms |
7616 KB |
Output isn't correct |
9 |
Incorrect |
97 ms |
7964 KB |
Output isn't correct |
10 |
Incorrect |
95 ms |
7744 KB |
Output isn't correct |
11 |
Incorrect |
102 ms |
7764 KB |
Output isn't correct |
12 |
Incorrect |
101 ms |
7744 KB |
Output isn't correct |
13 |
Incorrect |
119 ms |
8036 KB |
Output isn't correct |
14 |
Incorrect |
99 ms |
7812 KB |
Output isn't correct |
15 |
Incorrect |
104 ms |
7744 KB |
Output isn't correct |
16 |
Incorrect |
116 ms |
7964 KB |
Output isn't correct |
17 |
Incorrect |
114 ms |
8128 KB |
Output isn't correct |
18 |
Incorrect |
116 ms |
8012 KB |
Output isn't correct |
19 |
Incorrect |
101 ms |
7872 KB |
Output isn't correct |
20 |
Incorrect |
138 ms |
8412 KB |
Output isn't correct |
21 |
Incorrect |
143 ms |
8260 KB |
Output isn't correct |
22 |
Incorrect |
120 ms |
8000 KB |
Output isn't correct |
23 |
Incorrect |
141 ms |
8260 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
287 ms |
9924 KB |
Output isn't correct |
2 |
Incorrect |
12 ms |
4716 KB |
wrong parameter |
3 |
Incorrect |
91 ms |
7688 KB |
Output isn't correct |
4 |
Incorrect |
12 ms |
4776 KB |
Output isn't correct |
5 |
Incorrect |
99 ms |
7616 KB |
Output isn't correct |
6 |
Incorrect |
96 ms |
7744 KB |
Output isn't correct |
7 |
Incorrect |
114 ms |
8000 KB |
Output isn't correct |
8 |
Incorrect |
97 ms |
7616 KB |
Output isn't correct |
9 |
Incorrect |
97 ms |
7964 KB |
Output isn't correct |
10 |
Incorrect |
95 ms |
7744 KB |
Output isn't correct |
11 |
Incorrect |
102 ms |
7764 KB |
Output isn't correct |
12 |
Incorrect |
101 ms |
7744 KB |
Output isn't correct |
13 |
Incorrect |
119 ms |
8036 KB |
Output isn't correct |
14 |
Incorrect |
99 ms |
7812 KB |
Output isn't correct |
15 |
Incorrect |
104 ms |
7744 KB |
Output isn't correct |
16 |
Incorrect |
116 ms |
7964 KB |
Output isn't correct |
17 |
Incorrect |
114 ms |
8128 KB |
Output isn't correct |
18 |
Incorrect |
116 ms |
8012 KB |
Output isn't correct |
19 |
Incorrect |
101 ms |
7872 KB |
Output isn't correct |
20 |
Incorrect |
138 ms |
8412 KB |
Output isn't correct |
21 |
Incorrect |
143 ms |
8260 KB |
Output isn't correct |
22 |
Incorrect |
120 ms |
8000 KB |
Output isn't correct |
23 |
Incorrect |
141 ms |
8260 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
287 ms |
9924 KB |
Output isn't correct |
2 |
Incorrect |
12 ms |
4716 KB |
wrong parameter |
3 |
Incorrect |
91 ms |
7688 KB |
Output isn't correct |
4 |
Incorrect |
12 ms |
4776 KB |
Output isn't correct |
5 |
Incorrect |
99 ms |
7616 KB |
Output isn't correct |
6 |
Incorrect |
96 ms |
7744 KB |
Output isn't correct |
7 |
Incorrect |
114 ms |
8000 KB |
Output isn't correct |
8 |
Incorrect |
97 ms |
7616 KB |
Output isn't correct |
9 |
Incorrect |
97 ms |
7964 KB |
Output isn't correct |
10 |
Incorrect |
95 ms |
7744 KB |
Output isn't correct |
11 |
Incorrect |
102 ms |
7764 KB |
Output isn't correct |
12 |
Incorrect |
101 ms |
7744 KB |
Output isn't correct |
13 |
Incorrect |
119 ms |
8036 KB |
Output isn't correct |
14 |
Incorrect |
99 ms |
7812 KB |
Output isn't correct |
15 |
Incorrect |
104 ms |
7744 KB |
Output isn't correct |
16 |
Incorrect |
116 ms |
7964 KB |
Output isn't correct |
17 |
Incorrect |
114 ms |
8128 KB |
Output isn't correct |
18 |
Incorrect |
116 ms |
8012 KB |
Output isn't correct |
19 |
Incorrect |
101 ms |
7872 KB |
Output isn't correct |
20 |
Incorrect |
138 ms |
8412 KB |
Output isn't correct |
21 |
Incorrect |
143 ms |
8260 KB |
Output isn't correct |
22 |
Incorrect |
120 ms |
8000 KB |
Output isn't correct |
23 |
Incorrect |
141 ms |
8260 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
287 ms |
9924 KB |
Output isn't correct |
2 |
Incorrect |
12 ms |
4716 KB |
wrong parameter |
3 |
Incorrect |
91 ms |
7688 KB |
Output isn't correct |
4 |
Incorrect |
12 ms |
4776 KB |
Output isn't correct |
5 |
Incorrect |
99 ms |
7616 KB |
Output isn't correct |
6 |
Incorrect |
96 ms |
7744 KB |
Output isn't correct |
7 |
Incorrect |
114 ms |
8000 KB |
Output isn't correct |
8 |
Incorrect |
97 ms |
7616 KB |
Output isn't correct |
9 |
Incorrect |
97 ms |
7964 KB |
Output isn't correct |
10 |
Incorrect |
95 ms |
7744 KB |
Output isn't correct |
11 |
Incorrect |
102 ms |
7764 KB |
Output isn't correct |
12 |
Incorrect |
101 ms |
7744 KB |
Output isn't correct |
13 |
Incorrect |
119 ms |
8036 KB |
Output isn't correct |
14 |
Incorrect |
99 ms |
7812 KB |
Output isn't correct |
15 |
Incorrect |
104 ms |
7744 KB |
Output isn't correct |
16 |
Incorrect |
116 ms |
7964 KB |
Output isn't correct |
17 |
Incorrect |
114 ms |
8128 KB |
Output isn't correct |
18 |
Incorrect |
116 ms |
8012 KB |
Output isn't correct |
19 |
Incorrect |
101 ms |
7872 KB |
Output isn't correct |
20 |
Incorrect |
138 ms |
8412 KB |
Output isn't correct |
21 |
Incorrect |
143 ms |
8260 KB |
Output isn't correct |
22 |
Incorrect |
120 ms |
8000 KB |
Output isn't correct |
23 |
Incorrect |
141 ms |
8260 KB |
Output isn't correct |