#include <bits/stdc++.h>
#include "grader.h"
#include "encoder.h"
using namespace std;
const int MAX_N = 1000;
vector <int> graph[MAX_N];
int dist[MAX_N][MAX_N];
void encode(int nv, int nh, int ne, int *v1, int *v2) {
for(int i = 0; i < ne; i++) {
graph[v1[i]].push_back(v2[i]);
graph[v2[i]].push_back(v1[i]);
}
for(int i = 0; i < nh; i++) {
for(int j = 0; j < nv; j++) {
dist[i][j] = -1;
}
queue <int> q;
dist[i][i] = 0;
q.push(i);
while(!q.empty()) {
int u = q.front();
q.pop();
for(auto v : graph[u]) {
if(dist[i][v] == -1) {
dist[i][v] = dist[i][u] + 1;
q.push(v);
}
}
}
}
for(int i = 0; i < nh; i++) {
for(int j = 0; j < nv; j++) {
for(int k = 0; k < 10; k++) {
if((1<<k) & dist[i][j]) {
encode_bit(1);
}
else {
encode_bit(0);
}
}
}
}
}
#include <bits/stdc++.h>
#include "grader.h"
#include "decoder.h"
using namespace std;
void decode(int nv, int nh) {
for(int i = 0; i < nh; i++) {
for(int j = 0; j < nv; j++) {
int sum = 0;
for(int k = 0; k < 10; k++) {
sum += (1<<k) * decode_bit();
}
hops(i, j, sum);
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
305 ms |
12628 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
3 ms |
4616 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
79 ms |
7644 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
3 ms |
4608 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
65 ms |
7588 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
82 ms |
7864 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
80 ms |
8340 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
72 ms |
7700 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
93 ms |
7712 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
74 ms |
7708 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
72 ms |
7872 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
80 ms |
7756 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
101 ms |
8460 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
88 ms |
7752 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
80 ms |
7832 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
101 ms |
8284 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
134 ms |
8184 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
108 ms |
8448 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
84 ms |
8064 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
113 ms |
8816 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
158 ms |
8892 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
100 ms |
8296 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
121 ms |
9052 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
305 ms |
12628 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
3 ms |
4616 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
79 ms |
7644 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
3 ms |
4608 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
65 ms |
7588 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
82 ms |
7864 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
80 ms |
8340 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
72 ms |
7700 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
93 ms |
7712 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
74 ms |
7708 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
72 ms |
7872 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
80 ms |
7756 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
101 ms |
8460 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
88 ms |
7752 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
80 ms |
7832 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
101 ms |
8284 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
134 ms |
8184 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
108 ms |
8448 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
84 ms |
8064 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
113 ms |
8816 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
158 ms |
8892 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
100 ms |
8296 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
121 ms |
9052 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
305 ms |
12628 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
3 ms |
4616 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
79 ms |
7644 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
3 ms |
4608 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
65 ms |
7588 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
82 ms |
7864 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
80 ms |
8340 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
72 ms |
7700 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
93 ms |
7712 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
74 ms |
7708 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
72 ms |
7872 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
80 ms |
7756 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
101 ms |
8460 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
88 ms |
7752 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
80 ms |
7832 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
101 ms |
8284 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
134 ms |
8184 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
108 ms |
8448 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
84 ms |
8064 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
113 ms |
8816 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
158 ms |
8892 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
100 ms |
8296 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
121 ms |
9052 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
305 ms |
12628 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
3 ms |
4616 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
79 ms |
7644 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
3 ms |
4608 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
65 ms |
7588 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
82 ms |
7864 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
80 ms |
8340 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
72 ms |
7700 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
93 ms |
7712 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
74 ms |
7708 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
72 ms |
7872 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
80 ms |
7756 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
101 ms |
8460 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
88 ms |
7752 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
80 ms |
7832 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
101 ms |
8284 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
134 ms |
8184 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
108 ms |
8448 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
84 ms |
8064 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
113 ms |
8816 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
158 ms |
8892 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
100 ms |
8296 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
121 ms |
9052 KB |
Output is partially correct - 360000 call(s) of encode_bit() |