#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;
q.push(i);
}
}
}
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);
^~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
310 ms |
13760 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
10 ms |
4804 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
80 ms |
7600 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
10 ms |
4800 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
83 ms |
7544 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
92 ms |
7928 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
114 ms |
8476 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
89 ms |
7548 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
100 ms |
7876 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
93 ms |
7820 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
93 ms |
7928 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
91 ms |
7792 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
129 ms |
8460 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
93 ms |
7800 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
91 ms |
7812 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
113 ms |
8336 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
111 ms |
8208 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
129 ms |
8560 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
108 ms |
8240 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
137 ms |
8860 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
137 ms |
9176 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
113 ms |
8688 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
141 ms |
9200 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
310 ms |
13760 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
10 ms |
4804 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
80 ms |
7600 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
10 ms |
4800 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
83 ms |
7544 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
92 ms |
7928 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
114 ms |
8476 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
89 ms |
7548 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
100 ms |
7876 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
93 ms |
7820 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
93 ms |
7928 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
91 ms |
7792 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
129 ms |
8460 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
93 ms |
7800 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
91 ms |
7812 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
113 ms |
8336 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
111 ms |
8208 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
129 ms |
8560 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
108 ms |
8240 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
137 ms |
8860 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
137 ms |
9176 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
113 ms |
8688 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
141 ms |
9200 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
310 ms |
13760 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
10 ms |
4804 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
80 ms |
7600 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
10 ms |
4800 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
83 ms |
7544 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
92 ms |
7928 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
114 ms |
8476 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
89 ms |
7548 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
100 ms |
7876 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
93 ms |
7820 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
93 ms |
7928 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
91 ms |
7792 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
129 ms |
8460 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
93 ms |
7800 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
91 ms |
7812 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
113 ms |
8336 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
111 ms |
8208 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
129 ms |
8560 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
108 ms |
8240 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
137 ms |
8860 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
137 ms |
9176 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
113 ms |
8688 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
141 ms |
9200 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
310 ms |
13760 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
10 ms |
4804 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
80 ms |
7600 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
10 ms |
4800 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
83 ms |
7544 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
92 ms |
7928 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
114 ms |
8476 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
89 ms |
7548 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
100 ms |
7876 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
93 ms |
7820 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
93 ms |
7928 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
91 ms |
7792 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
129 ms |
8460 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
93 ms |
7800 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
91 ms |
7812 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
113 ms |
8336 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
111 ms |
8208 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
129 ms |
8560 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
108 ms |
8240 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
137 ms |
8860 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
137 ms |
9176 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
113 ms |
8688 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
141 ms |
9200 KB |
Output is partially correct - 360000 call(s) of encode_bit() |