#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))&1));
}
}
}
}
#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 |
289 ms |
9748 KB |
Output isn't correct |
2 |
Incorrect |
11 ms |
4672 KB |
Output isn't correct |
3 |
Incorrect |
98 ms |
7620 KB |
Output isn't correct |
4 |
Incorrect |
10 ms |
4788 KB |
Output isn't correct |
5 |
Incorrect |
88 ms |
7492 KB |
Output isn't correct |
6 |
Incorrect |
92 ms |
7984 KB |
Output isn't correct |
7 |
Incorrect |
128 ms |
8252 KB |
Output isn't correct |
8 |
Incorrect |
90 ms |
7656 KB |
Output isn't correct |
9 |
Incorrect |
103 ms |
7876 KB |
Output isn't correct |
10 |
Incorrect |
95 ms |
7876 KB |
Output isn't correct |
11 |
Incorrect |
106 ms |
7872 KB |
Output isn't correct |
12 |
Incorrect |
104 ms |
7816 KB |
Output isn't correct |
13 |
Incorrect |
122 ms |
8012 KB |
Output isn't correct |
14 |
Incorrect |
106 ms |
7744 KB |
Output isn't correct |
15 |
Incorrect |
95 ms |
8004 KB |
Output isn't correct |
16 |
Incorrect |
114 ms |
8128 KB |
Output isn't correct |
17 |
Incorrect |
110 ms |
8100 KB |
Output isn't correct |
18 |
Incorrect |
125 ms |
8044 KB |
Output isn't correct |
19 |
Incorrect |
100 ms |
7872 KB |
Output isn't correct |
20 |
Incorrect |
133 ms |
8256 KB |
Output isn't correct |
21 |
Incorrect |
140 ms |
8380 KB |
Output isn't correct |
22 |
Incorrect |
114 ms |
8000 KB |
Output isn't correct |
23 |
Incorrect |
138 ms |
8128 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
289 ms |
9748 KB |
Output isn't correct |
2 |
Incorrect |
11 ms |
4672 KB |
Output isn't correct |
3 |
Incorrect |
98 ms |
7620 KB |
Output isn't correct |
4 |
Incorrect |
10 ms |
4788 KB |
Output isn't correct |
5 |
Incorrect |
88 ms |
7492 KB |
Output isn't correct |
6 |
Incorrect |
92 ms |
7984 KB |
Output isn't correct |
7 |
Incorrect |
128 ms |
8252 KB |
Output isn't correct |
8 |
Incorrect |
90 ms |
7656 KB |
Output isn't correct |
9 |
Incorrect |
103 ms |
7876 KB |
Output isn't correct |
10 |
Incorrect |
95 ms |
7876 KB |
Output isn't correct |
11 |
Incorrect |
106 ms |
7872 KB |
Output isn't correct |
12 |
Incorrect |
104 ms |
7816 KB |
Output isn't correct |
13 |
Incorrect |
122 ms |
8012 KB |
Output isn't correct |
14 |
Incorrect |
106 ms |
7744 KB |
Output isn't correct |
15 |
Incorrect |
95 ms |
8004 KB |
Output isn't correct |
16 |
Incorrect |
114 ms |
8128 KB |
Output isn't correct |
17 |
Incorrect |
110 ms |
8100 KB |
Output isn't correct |
18 |
Incorrect |
125 ms |
8044 KB |
Output isn't correct |
19 |
Incorrect |
100 ms |
7872 KB |
Output isn't correct |
20 |
Incorrect |
133 ms |
8256 KB |
Output isn't correct |
21 |
Incorrect |
140 ms |
8380 KB |
Output isn't correct |
22 |
Incorrect |
114 ms |
8000 KB |
Output isn't correct |
23 |
Incorrect |
138 ms |
8128 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
289 ms |
9748 KB |
Output isn't correct |
2 |
Incorrect |
11 ms |
4672 KB |
Output isn't correct |
3 |
Incorrect |
98 ms |
7620 KB |
Output isn't correct |
4 |
Incorrect |
10 ms |
4788 KB |
Output isn't correct |
5 |
Incorrect |
88 ms |
7492 KB |
Output isn't correct |
6 |
Incorrect |
92 ms |
7984 KB |
Output isn't correct |
7 |
Incorrect |
128 ms |
8252 KB |
Output isn't correct |
8 |
Incorrect |
90 ms |
7656 KB |
Output isn't correct |
9 |
Incorrect |
103 ms |
7876 KB |
Output isn't correct |
10 |
Incorrect |
95 ms |
7876 KB |
Output isn't correct |
11 |
Incorrect |
106 ms |
7872 KB |
Output isn't correct |
12 |
Incorrect |
104 ms |
7816 KB |
Output isn't correct |
13 |
Incorrect |
122 ms |
8012 KB |
Output isn't correct |
14 |
Incorrect |
106 ms |
7744 KB |
Output isn't correct |
15 |
Incorrect |
95 ms |
8004 KB |
Output isn't correct |
16 |
Incorrect |
114 ms |
8128 KB |
Output isn't correct |
17 |
Incorrect |
110 ms |
8100 KB |
Output isn't correct |
18 |
Incorrect |
125 ms |
8044 KB |
Output isn't correct |
19 |
Incorrect |
100 ms |
7872 KB |
Output isn't correct |
20 |
Incorrect |
133 ms |
8256 KB |
Output isn't correct |
21 |
Incorrect |
140 ms |
8380 KB |
Output isn't correct |
22 |
Incorrect |
114 ms |
8000 KB |
Output isn't correct |
23 |
Incorrect |
138 ms |
8128 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
289 ms |
9748 KB |
Output isn't correct |
2 |
Incorrect |
11 ms |
4672 KB |
Output isn't correct |
3 |
Incorrect |
98 ms |
7620 KB |
Output isn't correct |
4 |
Incorrect |
10 ms |
4788 KB |
Output isn't correct |
5 |
Incorrect |
88 ms |
7492 KB |
Output isn't correct |
6 |
Incorrect |
92 ms |
7984 KB |
Output isn't correct |
7 |
Incorrect |
128 ms |
8252 KB |
Output isn't correct |
8 |
Incorrect |
90 ms |
7656 KB |
Output isn't correct |
9 |
Incorrect |
103 ms |
7876 KB |
Output isn't correct |
10 |
Incorrect |
95 ms |
7876 KB |
Output isn't correct |
11 |
Incorrect |
106 ms |
7872 KB |
Output isn't correct |
12 |
Incorrect |
104 ms |
7816 KB |
Output isn't correct |
13 |
Incorrect |
122 ms |
8012 KB |
Output isn't correct |
14 |
Incorrect |
106 ms |
7744 KB |
Output isn't correct |
15 |
Incorrect |
95 ms |
8004 KB |
Output isn't correct |
16 |
Incorrect |
114 ms |
8128 KB |
Output isn't correct |
17 |
Incorrect |
110 ms |
8100 KB |
Output isn't correct |
18 |
Incorrect |
125 ms |
8044 KB |
Output isn't correct |
19 |
Incorrect |
100 ms |
7872 KB |
Output isn't correct |
20 |
Incorrect |
133 ms |
8256 KB |
Output isn't correct |
21 |
Incorrect |
140 ms |
8380 KB |
Output isn't correct |
22 |
Incorrect |
114 ms |
8000 KB |
Output isn't correct |
23 |
Incorrect |
138 ms |
8128 KB |
Output isn't correct |