#include <bits/stdc++.h>
#include "grader.h"
#include "encoder.h"
using namespace std;
void encode(int nv, int nh, int ne, int *v1, int *v2){
vector<vector<int>> adj(nv);
for (int i = 0; i < ne; i++) {
adj[v1[i]].push_back(v2[i]);
adj[v2[i]].push_back(v1[i]);
}
for (int i = 0; i < nh; i++)
{
queue<int> q({i});
vector<int> dist(nv, INT_MAX);
dist[i] = 0;
while(q.size()){
int a = q.front(); q.pop();
for (auto b : adj[a]) {
if(dist[b] > dist[a] + 1){
dist[b] = dist[a] + 1;
q.push(b);
}
}
}
for (int i = 0; i < nv; i++) {
for (int b = 0; b < 9; b++) {
encode_bit((bool)(dist[i] & (1 << b)));
}
}
}
return;
}
#include "grader.h"
#include "decoder.h"
#include <bits/stdc++.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 res = 0;
for (int k = 0, x = 1; k < 9; k++, x *= 2) {
if(decode_bit()){
res += x;
}
}
hops(i, j, res);
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
221 ms |
20848 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
2 |
Correct |
2 ms |
11264 KB |
Output is correct - 135 call(s) of encode_bit() |
3 |
Correct |
45 ms |
15416 KB |
Output is partially correct - 291600 call(s) of encode_bit() |
4 |
Correct |
2 ms |
11264 KB |
Output is correct - 225 call(s) of encode_bit() |
5 |
Correct |
51 ms |
15748 KB |
Output is partially correct - 291600 call(s) of encode_bit() |
6 |
Correct |
58 ms |
15512 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
7 |
Correct |
71 ms |
16004 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
8 |
Correct |
51 ms |
15364 KB |
Output is partially correct - 311364 call(s) of encode_bit() |
9 |
Correct |
58 ms |
15576 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
10 |
Correct |
53 ms |
15504 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
11 |
Correct |
56 ms |
15716 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
12 |
Incorrect |
51 ms |
15372 KB |
Output isn't correct |
13 |
Correct |
73 ms |
15884 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
14 |
Incorrect |
51 ms |
15368 KB |
Output isn't correct |
15 |
Incorrect |
53 ms |
15436 KB |
Output isn't correct |
16 |
Correct |
69 ms |
15884 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
17 |
Correct |
62 ms |
16048 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
18 |
Correct |
72 ms |
15968 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
19 |
Correct |
66 ms |
15772 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
20 |
Correct |
84 ms |
18216 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
21 |
Correct |
87 ms |
18328 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
22 |
Correct |
65 ms |
15888 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
23 |
Correct |
118 ms |
18704 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
221 ms |
20848 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
2 |
Correct |
2 ms |
11264 KB |
Output is correct - 135 call(s) of encode_bit() |
3 |
Correct |
45 ms |
15416 KB |
Output is partially correct - 291600 call(s) of encode_bit() |
4 |
Correct |
2 ms |
11264 KB |
Output is correct - 225 call(s) of encode_bit() |
5 |
Correct |
51 ms |
15748 KB |
Output is partially correct - 291600 call(s) of encode_bit() |
6 |
Correct |
58 ms |
15512 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
7 |
Correct |
71 ms |
16004 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
8 |
Correct |
51 ms |
15364 KB |
Output is partially correct - 311364 call(s) of encode_bit() |
9 |
Correct |
58 ms |
15576 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
10 |
Correct |
53 ms |
15504 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
11 |
Correct |
56 ms |
15716 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
12 |
Incorrect |
51 ms |
15372 KB |
Output isn't correct |
13 |
Correct |
73 ms |
15884 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
14 |
Incorrect |
51 ms |
15368 KB |
Output isn't correct |
15 |
Incorrect |
53 ms |
15436 KB |
Output isn't correct |
16 |
Correct |
69 ms |
15884 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
17 |
Correct |
62 ms |
16048 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
18 |
Correct |
72 ms |
15968 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
19 |
Correct |
66 ms |
15772 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
20 |
Correct |
84 ms |
18216 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
21 |
Correct |
87 ms |
18328 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
22 |
Correct |
65 ms |
15888 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
23 |
Correct |
118 ms |
18704 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
221 ms |
20848 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
2 |
Correct |
2 ms |
11264 KB |
Output is correct - 135 call(s) of encode_bit() |
3 |
Correct |
45 ms |
15416 KB |
Output is partially correct - 291600 call(s) of encode_bit() |
4 |
Correct |
2 ms |
11264 KB |
Output is correct - 225 call(s) of encode_bit() |
5 |
Correct |
51 ms |
15748 KB |
Output is partially correct - 291600 call(s) of encode_bit() |
6 |
Correct |
58 ms |
15512 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
7 |
Correct |
71 ms |
16004 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
8 |
Correct |
51 ms |
15364 KB |
Output is partially correct - 311364 call(s) of encode_bit() |
9 |
Correct |
58 ms |
15576 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
10 |
Correct |
53 ms |
15504 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
11 |
Correct |
56 ms |
15716 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
12 |
Incorrect |
51 ms |
15372 KB |
Output isn't correct |
13 |
Correct |
73 ms |
15884 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
14 |
Incorrect |
51 ms |
15368 KB |
Output isn't correct |
15 |
Incorrect |
53 ms |
15436 KB |
Output isn't correct |
16 |
Correct |
69 ms |
15884 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
17 |
Correct |
62 ms |
16048 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
18 |
Correct |
72 ms |
15968 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
19 |
Correct |
66 ms |
15772 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
20 |
Correct |
84 ms |
18216 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
21 |
Correct |
87 ms |
18328 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
22 |
Correct |
65 ms |
15888 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
23 |
Correct |
118 ms |
18704 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
221 ms |
20848 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
2 |
Correct |
2 ms |
11264 KB |
Output is correct - 135 call(s) of encode_bit() |
3 |
Correct |
45 ms |
15416 KB |
Output is partially correct - 291600 call(s) of encode_bit() |
4 |
Correct |
2 ms |
11264 KB |
Output is correct - 225 call(s) of encode_bit() |
5 |
Correct |
51 ms |
15748 KB |
Output is partially correct - 291600 call(s) of encode_bit() |
6 |
Correct |
58 ms |
15512 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
7 |
Correct |
71 ms |
16004 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
8 |
Correct |
51 ms |
15364 KB |
Output is partially correct - 311364 call(s) of encode_bit() |
9 |
Correct |
58 ms |
15576 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
10 |
Correct |
53 ms |
15504 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
11 |
Correct |
56 ms |
15716 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
12 |
Incorrect |
51 ms |
15372 KB |
Output isn't correct |
13 |
Correct |
73 ms |
15884 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
14 |
Incorrect |
51 ms |
15368 KB |
Output isn't correct |
15 |
Incorrect |
53 ms |
15436 KB |
Output isn't correct |
16 |
Correct |
69 ms |
15884 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
17 |
Correct |
62 ms |
16048 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
18 |
Correct |
72 ms |
15968 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
19 |
Correct |
66 ms |
15772 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
20 |
Correct |
84 ms |
18216 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
21 |
Correct |
87 ms |
18328 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
22 |
Correct |
65 ms |
15888 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
23 |
Correct |
118 ms |
18704 KB |
Output is partially correct - 324000 call(s) of encode_bit() |