#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);
}
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++) {
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:9:4: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
for (int x = 0; x < 10; x++)
^~~
decoder.cpp:12:4: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
hops(s,f,ans);
^~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
346 ms |
13808 KB |
Output isn't correct |
2 |
Incorrect |
10 ms |
4744 KB |
Output isn't correct |
3 |
Incorrect |
97 ms |
7680 KB |
Output isn't correct |
4 |
Incorrect |
10 ms |
4864 KB |
Output isn't correct |
5 |
Incorrect |
82 ms |
7552 KB |
Output isn't correct |
6 |
Incorrect |
93 ms |
8036 KB |
Output isn't correct |
7 |
Incorrect |
109 ms |
8312 KB |
Output isn't correct |
8 |
Incorrect |
97 ms |
7648 KB |
Output isn't correct |
9 |
Incorrect |
98 ms |
7868 KB |
Output isn't correct |
10 |
Incorrect |
100 ms |
7784 KB |
Output isn't correct |
11 |
Incorrect |
95 ms |
7988 KB |
Output isn't correct |
12 |
Incorrect |
96 ms |
7760 KB |
Output isn't correct |
13 |
Incorrect |
125 ms |
8552 KB |
Output isn't correct |
14 |
Incorrect |
90 ms |
7744 KB |
Output isn't correct |
15 |
Incorrect |
88 ms |
7892 KB |
Output isn't correct |
16 |
Incorrect |
129 ms |
8344 KB |
Output isn't correct |
17 |
Incorrect |
114 ms |
8376 KB |
Output isn't correct |
18 |
Incorrect |
114 ms |
8568 KB |
Output isn't correct |
19 |
Incorrect |
94 ms |
8192 KB |
Output isn't correct |
20 |
Incorrect |
138 ms |
9204 KB |
Output isn't correct |
21 |
Incorrect |
155 ms |
8892 KB |
Output isn't correct |
22 |
Incorrect |
121 ms |
8568 KB |
Output isn't correct |
23 |
Incorrect |
128 ms |
9080 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
346 ms |
13808 KB |
Output isn't correct |
2 |
Incorrect |
10 ms |
4744 KB |
Output isn't correct |
3 |
Incorrect |
97 ms |
7680 KB |
Output isn't correct |
4 |
Incorrect |
10 ms |
4864 KB |
Output isn't correct |
5 |
Incorrect |
82 ms |
7552 KB |
Output isn't correct |
6 |
Incorrect |
93 ms |
8036 KB |
Output isn't correct |
7 |
Incorrect |
109 ms |
8312 KB |
Output isn't correct |
8 |
Incorrect |
97 ms |
7648 KB |
Output isn't correct |
9 |
Incorrect |
98 ms |
7868 KB |
Output isn't correct |
10 |
Incorrect |
100 ms |
7784 KB |
Output isn't correct |
11 |
Incorrect |
95 ms |
7988 KB |
Output isn't correct |
12 |
Incorrect |
96 ms |
7760 KB |
Output isn't correct |
13 |
Incorrect |
125 ms |
8552 KB |
Output isn't correct |
14 |
Incorrect |
90 ms |
7744 KB |
Output isn't correct |
15 |
Incorrect |
88 ms |
7892 KB |
Output isn't correct |
16 |
Incorrect |
129 ms |
8344 KB |
Output isn't correct |
17 |
Incorrect |
114 ms |
8376 KB |
Output isn't correct |
18 |
Incorrect |
114 ms |
8568 KB |
Output isn't correct |
19 |
Incorrect |
94 ms |
8192 KB |
Output isn't correct |
20 |
Incorrect |
138 ms |
9204 KB |
Output isn't correct |
21 |
Incorrect |
155 ms |
8892 KB |
Output isn't correct |
22 |
Incorrect |
121 ms |
8568 KB |
Output isn't correct |
23 |
Incorrect |
128 ms |
9080 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
346 ms |
13808 KB |
Output isn't correct |
2 |
Incorrect |
10 ms |
4744 KB |
Output isn't correct |
3 |
Incorrect |
97 ms |
7680 KB |
Output isn't correct |
4 |
Incorrect |
10 ms |
4864 KB |
Output isn't correct |
5 |
Incorrect |
82 ms |
7552 KB |
Output isn't correct |
6 |
Incorrect |
93 ms |
8036 KB |
Output isn't correct |
7 |
Incorrect |
109 ms |
8312 KB |
Output isn't correct |
8 |
Incorrect |
97 ms |
7648 KB |
Output isn't correct |
9 |
Incorrect |
98 ms |
7868 KB |
Output isn't correct |
10 |
Incorrect |
100 ms |
7784 KB |
Output isn't correct |
11 |
Incorrect |
95 ms |
7988 KB |
Output isn't correct |
12 |
Incorrect |
96 ms |
7760 KB |
Output isn't correct |
13 |
Incorrect |
125 ms |
8552 KB |
Output isn't correct |
14 |
Incorrect |
90 ms |
7744 KB |
Output isn't correct |
15 |
Incorrect |
88 ms |
7892 KB |
Output isn't correct |
16 |
Incorrect |
129 ms |
8344 KB |
Output isn't correct |
17 |
Incorrect |
114 ms |
8376 KB |
Output isn't correct |
18 |
Incorrect |
114 ms |
8568 KB |
Output isn't correct |
19 |
Incorrect |
94 ms |
8192 KB |
Output isn't correct |
20 |
Incorrect |
138 ms |
9204 KB |
Output isn't correct |
21 |
Incorrect |
155 ms |
8892 KB |
Output isn't correct |
22 |
Incorrect |
121 ms |
8568 KB |
Output isn't correct |
23 |
Incorrect |
128 ms |
9080 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
346 ms |
13808 KB |
Output isn't correct |
2 |
Incorrect |
10 ms |
4744 KB |
Output isn't correct |
3 |
Incorrect |
97 ms |
7680 KB |
Output isn't correct |
4 |
Incorrect |
10 ms |
4864 KB |
Output isn't correct |
5 |
Incorrect |
82 ms |
7552 KB |
Output isn't correct |
6 |
Incorrect |
93 ms |
8036 KB |
Output isn't correct |
7 |
Incorrect |
109 ms |
8312 KB |
Output isn't correct |
8 |
Incorrect |
97 ms |
7648 KB |
Output isn't correct |
9 |
Incorrect |
98 ms |
7868 KB |
Output isn't correct |
10 |
Incorrect |
100 ms |
7784 KB |
Output isn't correct |
11 |
Incorrect |
95 ms |
7988 KB |
Output isn't correct |
12 |
Incorrect |
96 ms |
7760 KB |
Output isn't correct |
13 |
Incorrect |
125 ms |
8552 KB |
Output isn't correct |
14 |
Incorrect |
90 ms |
7744 KB |
Output isn't correct |
15 |
Incorrect |
88 ms |
7892 KB |
Output isn't correct |
16 |
Incorrect |
129 ms |
8344 KB |
Output isn't correct |
17 |
Incorrect |
114 ms |
8376 KB |
Output isn't correct |
18 |
Incorrect |
114 ms |
8568 KB |
Output isn't correct |
19 |
Incorrect |
94 ms |
8192 KB |
Output isn't correct |
20 |
Incorrect |
138 ms |
9204 KB |
Output isn't correct |
21 |
Incorrect |
155 ms |
8892 KB |
Output isn't correct |
22 |
Incorrect |
121 ms |
8568 KB |
Output isn't correct |
23 |
Incorrect |
128 ms |
9080 KB |
Output isn't correct |