#include<bits/stdc++.h>
#include "grader.h"
#include "encoder.h"
using namespace std;
vector<int> adj[1005];
bool vis[1005];
int dis[1005];
void binary (int n) {
for (int i = 0; i < 10; i++)
if ((1 << i) & n) encode_bit(1);
else encode_bit(0);
}
void encode(int nv, int nh, int ne, int *v1, int *v2){
for (int i = 0; i < ne; i++) {
adj[v1[i]].push_back(v2[i]);
adj[v2[i]].push_back(v1[i]);
}
for (int s = 0; s < nh; s++) {
queue<int> q;
q.push(s);
vis[s] = 1;
while (!q.empty()) {
int v = q.front();
q.pop();
for (auto i : adj[v]) {
if (!vis[i]) {
vis[i] = 1;
dis[i] = dis[v] + 1;
}
}
}
for (int i = 0; i < nv; i++)
binary(dis[i]);
memset(vis,0,sizeof vis);
memset(dis,0,sizeof dis);
}
encode_bit(1);
encode_bit(0);
return;
}
#include<bits/stdc++.h>
#include "grader.h"
#include "decoder.h"
using namespace std;
void decode(int nv, int nh) {
for (int s = 0; s < nh; s++) {
int ans = 0;
for (int f = 0; f < nv; f++) {
int ans = 0;
for (int x = 0; x < 10; x++)
if (decode_bit())
ans |= (1 << x);
hops(s,f,ans);
}
}
}
Compilation message
decoder.cpp: In function 'void decode(int, int)':
decoder.cpp:10:4: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
for (int x = 0; x < 10; x++)
^~~
decoder.cpp:13:4: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
hops(s,f,ans);
^~~~
decoder.cpp:7:7: warning: unused variable 'ans' [-Wunused-variable]
int ans = 0;
^~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
283 ms |
13896 KB |
Output isn't correct |
2 |
Incorrect |
11 ms |
4872 KB |
Output isn't correct |
3 |
Incorrect |
76 ms |
7580 KB |
Output isn't correct |
4 |
Incorrect |
10 ms |
4736 KB |
Output isn't correct |
5 |
Incorrect |
79 ms |
7648 KB |
Output isn't correct |
6 |
Incorrect |
98 ms |
7928 KB |
Output isn't correct |
7 |
Incorrect |
106 ms |
8356 KB |
Output isn't correct |
8 |
Incorrect |
82 ms |
7644 KB |
Output isn't correct |
9 |
Incorrect |
84 ms |
7816 KB |
Output isn't correct |
10 |
Incorrect |
83 ms |
7680 KB |
Output isn't correct |
11 |
Incorrect |
93 ms |
8144 KB |
Output isn't correct |
12 |
Incorrect |
83 ms |
7808 KB |
Output isn't correct |
13 |
Incorrect |
117 ms |
8448 KB |
Output isn't correct |
14 |
Incorrect |
86 ms |
7936 KB |
Output isn't correct |
15 |
Incorrect |
96 ms |
7996 KB |
Output isn't correct |
16 |
Incorrect |
129 ms |
8400 KB |
Output isn't correct |
17 |
Incorrect |
100 ms |
8304 KB |
Output isn't correct |
18 |
Incorrect |
106 ms |
8484 KB |
Output isn't correct |
19 |
Incorrect |
110 ms |
8308 KB |
Output isn't correct |
20 |
Incorrect |
136 ms |
9076 KB |
Output isn't correct |
21 |
Incorrect |
149 ms |
8816 KB |
Output isn't correct |
22 |
Incorrect |
103 ms |
8552 KB |
Output isn't correct |
23 |
Incorrect |
134 ms |
9116 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
283 ms |
13896 KB |
Output isn't correct |
2 |
Incorrect |
11 ms |
4872 KB |
Output isn't correct |
3 |
Incorrect |
76 ms |
7580 KB |
Output isn't correct |
4 |
Incorrect |
10 ms |
4736 KB |
Output isn't correct |
5 |
Incorrect |
79 ms |
7648 KB |
Output isn't correct |
6 |
Incorrect |
98 ms |
7928 KB |
Output isn't correct |
7 |
Incorrect |
106 ms |
8356 KB |
Output isn't correct |
8 |
Incorrect |
82 ms |
7644 KB |
Output isn't correct |
9 |
Incorrect |
84 ms |
7816 KB |
Output isn't correct |
10 |
Incorrect |
83 ms |
7680 KB |
Output isn't correct |
11 |
Incorrect |
93 ms |
8144 KB |
Output isn't correct |
12 |
Incorrect |
83 ms |
7808 KB |
Output isn't correct |
13 |
Incorrect |
117 ms |
8448 KB |
Output isn't correct |
14 |
Incorrect |
86 ms |
7936 KB |
Output isn't correct |
15 |
Incorrect |
96 ms |
7996 KB |
Output isn't correct |
16 |
Incorrect |
129 ms |
8400 KB |
Output isn't correct |
17 |
Incorrect |
100 ms |
8304 KB |
Output isn't correct |
18 |
Incorrect |
106 ms |
8484 KB |
Output isn't correct |
19 |
Incorrect |
110 ms |
8308 KB |
Output isn't correct |
20 |
Incorrect |
136 ms |
9076 KB |
Output isn't correct |
21 |
Incorrect |
149 ms |
8816 KB |
Output isn't correct |
22 |
Incorrect |
103 ms |
8552 KB |
Output isn't correct |
23 |
Incorrect |
134 ms |
9116 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
283 ms |
13896 KB |
Output isn't correct |
2 |
Incorrect |
11 ms |
4872 KB |
Output isn't correct |
3 |
Incorrect |
76 ms |
7580 KB |
Output isn't correct |
4 |
Incorrect |
10 ms |
4736 KB |
Output isn't correct |
5 |
Incorrect |
79 ms |
7648 KB |
Output isn't correct |
6 |
Incorrect |
98 ms |
7928 KB |
Output isn't correct |
7 |
Incorrect |
106 ms |
8356 KB |
Output isn't correct |
8 |
Incorrect |
82 ms |
7644 KB |
Output isn't correct |
9 |
Incorrect |
84 ms |
7816 KB |
Output isn't correct |
10 |
Incorrect |
83 ms |
7680 KB |
Output isn't correct |
11 |
Incorrect |
93 ms |
8144 KB |
Output isn't correct |
12 |
Incorrect |
83 ms |
7808 KB |
Output isn't correct |
13 |
Incorrect |
117 ms |
8448 KB |
Output isn't correct |
14 |
Incorrect |
86 ms |
7936 KB |
Output isn't correct |
15 |
Incorrect |
96 ms |
7996 KB |
Output isn't correct |
16 |
Incorrect |
129 ms |
8400 KB |
Output isn't correct |
17 |
Incorrect |
100 ms |
8304 KB |
Output isn't correct |
18 |
Incorrect |
106 ms |
8484 KB |
Output isn't correct |
19 |
Incorrect |
110 ms |
8308 KB |
Output isn't correct |
20 |
Incorrect |
136 ms |
9076 KB |
Output isn't correct |
21 |
Incorrect |
149 ms |
8816 KB |
Output isn't correct |
22 |
Incorrect |
103 ms |
8552 KB |
Output isn't correct |
23 |
Incorrect |
134 ms |
9116 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
283 ms |
13896 KB |
Output isn't correct |
2 |
Incorrect |
11 ms |
4872 KB |
Output isn't correct |
3 |
Incorrect |
76 ms |
7580 KB |
Output isn't correct |
4 |
Incorrect |
10 ms |
4736 KB |
Output isn't correct |
5 |
Incorrect |
79 ms |
7648 KB |
Output isn't correct |
6 |
Incorrect |
98 ms |
7928 KB |
Output isn't correct |
7 |
Incorrect |
106 ms |
8356 KB |
Output isn't correct |
8 |
Incorrect |
82 ms |
7644 KB |
Output isn't correct |
9 |
Incorrect |
84 ms |
7816 KB |
Output isn't correct |
10 |
Incorrect |
83 ms |
7680 KB |
Output isn't correct |
11 |
Incorrect |
93 ms |
8144 KB |
Output isn't correct |
12 |
Incorrect |
83 ms |
7808 KB |
Output isn't correct |
13 |
Incorrect |
117 ms |
8448 KB |
Output isn't correct |
14 |
Incorrect |
86 ms |
7936 KB |
Output isn't correct |
15 |
Incorrect |
96 ms |
7996 KB |
Output isn't correct |
16 |
Incorrect |
129 ms |
8400 KB |
Output isn't correct |
17 |
Incorrect |
100 ms |
8304 KB |
Output isn't correct |
18 |
Incorrect |
106 ms |
8484 KB |
Output isn't correct |
19 |
Incorrect |
110 ms |
8308 KB |
Output isn't correct |
20 |
Incorrect |
136 ms |
9076 KB |
Output isn't correct |
21 |
Incorrect |
149 ms |
8816 KB |
Output isn't correct |
22 |
Incorrect |
103 ms |
8552 KB |
Output isn't correct |
23 |
Incorrect |
134 ms |
9116 KB |
Output isn't correct |