// Encoder
#include <bits/stdc++.h>
#include "encoder.h"
#include "grader.h"
#define maxn 1000
#define pb push_back
using namespace std;
int dist[maxn];
vector<int> adj[maxn];
void encode(int n, int h, int m, int *v1, int *v2) {
for( int i = 0 ; i < m ; i++ ) {
int u = v1[i] , v = v2[i];
adj[u].pb(v);
adj[v].pb(u);
}
for( int src = 0 ; src < h ; src++ ) {
queue<int> Q;
memset(dist,-1,sizeof(dist));
Q.push(src);
dist[src] = 0;
while(!Q.empty()) {
int u = Q.front();
Q.pop();
int deg = adj[u].size();
for( int i = 0 ; i < deg ; i++ ) {
int v = adj[u][i];
if(dist[v] == -1) {
Q.push(v);
dist[v] = dist[u]+1;
}
}
}
for( int i = 0 ; i < n ; i++ )
for( int j = 0 ; j < 10 ; j++ )
if(dist[i]&(1<<j))
encode_bit(1);
else
encode_bit(0);
}
}
// Decoder
#include <bits/stdc++.h>
#include "decoder.h"
#include "grader.h"
using namespace std;
void decode(int n, int h) {
for( int i = 0 ; i < h ; i++ )
for( int j = 0 ; j < n ; j++ ) {
int val = 0;
for( int k = 0 ; k < 10 ; k++ )
val |= (1<<decode_bit());
hops(i,j,val);
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
360 ms |
12640 KB |
Output isn't correct |
2 |
Incorrect |
2 ms |
4832 KB |
Output isn't correct |
3 |
Incorrect |
89 ms |
7600 KB |
Output isn't correct |
4 |
Incorrect |
3 ms |
4576 KB |
Output isn't correct |
5 |
Incorrect |
97 ms |
7700 KB |
Output isn't correct |
6 |
Incorrect |
95 ms |
8032 KB |
Output isn't correct |
7 |
Incorrect |
107 ms |
8372 KB |
Output isn't correct |
8 |
Incorrect |
84 ms |
7520 KB |
Output isn't correct |
9 |
Incorrect |
97 ms |
7872 KB |
Output isn't correct |
10 |
Incorrect |
93 ms |
7776 KB |
Output isn't correct |
11 |
Incorrect |
93 ms |
8096 KB |
Output isn't correct |
12 |
Incorrect |
90 ms |
7728 KB |
Output isn't correct |
13 |
Incorrect |
122 ms |
8512 KB |
Output isn't correct |
14 |
Incorrect |
100 ms |
7720 KB |
Output isn't correct |
15 |
Incorrect |
91 ms |
7936 KB |
Output isn't correct |
16 |
Incorrect |
133 ms |
8292 KB |
Output isn't correct |
17 |
Incorrect |
121 ms |
8160 KB |
Output isn't correct |
18 |
Incorrect |
118 ms |
8416 KB |
Output isn't correct |
19 |
Incorrect |
99 ms |
8160 KB |
Output isn't correct |
20 |
Incorrect |
132 ms |
8672 KB |
Output isn't correct |
21 |
Incorrect |
140 ms |
9056 KB |
Output isn't correct |
22 |
Incorrect |
132 ms |
8568 KB |
Output isn't correct |
23 |
Incorrect |
144 ms |
9056 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
360 ms |
12640 KB |
Output isn't correct |
2 |
Incorrect |
2 ms |
4832 KB |
Output isn't correct |
3 |
Incorrect |
89 ms |
7600 KB |
Output isn't correct |
4 |
Incorrect |
3 ms |
4576 KB |
Output isn't correct |
5 |
Incorrect |
97 ms |
7700 KB |
Output isn't correct |
6 |
Incorrect |
95 ms |
8032 KB |
Output isn't correct |
7 |
Incorrect |
107 ms |
8372 KB |
Output isn't correct |
8 |
Incorrect |
84 ms |
7520 KB |
Output isn't correct |
9 |
Incorrect |
97 ms |
7872 KB |
Output isn't correct |
10 |
Incorrect |
93 ms |
7776 KB |
Output isn't correct |
11 |
Incorrect |
93 ms |
8096 KB |
Output isn't correct |
12 |
Incorrect |
90 ms |
7728 KB |
Output isn't correct |
13 |
Incorrect |
122 ms |
8512 KB |
Output isn't correct |
14 |
Incorrect |
100 ms |
7720 KB |
Output isn't correct |
15 |
Incorrect |
91 ms |
7936 KB |
Output isn't correct |
16 |
Incorrect |
133 ms |
8292 KB |
Output isn't correct |
17 |
Incorrect |
121 ms |
8160 KB |
Output isn't correct |
18 |
Incorrect |
118 ms |
8416 KB |
Output isn't correct |
19 |
Incorrect |
99 ms |
8160 KB |
Output isn't correct |
20 |
Incorrect |
132 ms |
8672 KB |
Output isn't correct |
21 |
Incorrect |
140 ms |
9056 KB |
Output isn't correct |
22 |
Incorrect |
132 ms |
8568 KB |
Output isn't correct |
23 |
Incorrect |
144 ms |
9056 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
360 ms |
12640 KB |
Output isn't correct |
2 |
Incorrect |
2 ms |
4832 KB |
Output isn't correct |
3 |
Incorrect |
89 ms |
7600 KB |
Output isn't correct |
4 |
Incorrect |
3 ms |
4576 KB |
Output isn't correct |
5 |
Incorrect |
97 ms |
7700 KB |
Output isn't correct |
6 |
Incorrect |
95 ms |
8032 KB |
Output isn't correct |
7 |
Incorrect |
107 ms |
8372 KB |
Output isn't correct |
8 |
Incorrect |
84 ms |
7520 KB |
Output isn't correct |
9 |
Incorrect |
97 ms |
7872 KB |
Output isn't correct |
10 |
Incorrect |
93 ms |
7776 KB |
Output isn't correct |
11 |
Incorrect |
93 ms |
8096 KB |
Output isn't correct |
12 |
Incorrect |
90 ms |
7728 KB |
Output isn't correct |
13 |
Incorrect |
122 ms |
8512 KB |
Output isn't correct |
14 |
Incorrect |
100 ms |
7720 KB |
Output isn't correct |
15 |
Incorrect |
91 ms |
7936 KB |
Output isn't correct |
16 |
Incorrect |
133 ms |
8292 KB |
Output isn't correct |
17 |
Incorrect |
121 ms |
8160 KB |
Output isn't correct |
18 |
Incorrect |
118 ms |
8416 KB |
Output isn't correct |
19 |
Incorrect |
99 ms |
8160 KB |
Output isn't correct |
20 |
Incorrect |
132 ms |
8672 KB |
Output isn't correct |
21 |
Incorrect |
140 ms |
9056 KB |
Output isn't correct |
22 |
Incorrect |
132 ms |
8568 KB |
Output isn't correct |
23 |
Incorrect |
144 ms |
9056 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
360 ms |
12640 KB |
Output isn't correct |
2 |
Incorrect |
2 ms |
4832 KB |
Output isn't correct |
3 |
Incorrect |
89 ms |
7600 KB |
Output isn't correct |
4 |
Incorrect |
3 ms |
4576 KB |
Output isn't correct |
5 |
Incorrect |
97 ms |
7700 KB |
Output isn't correct |
6 |
Incorrect |
95 ms |
8032 KB |
Output isn't correct |
7 |
Incorrect |
107 ms |
8372 KB |
Output isn't correct |
8 |
Incorrect |
84 ms |
7520 KB |
Output isn't correct |
9 |
Incorrect |
97 ms |
7872 KB |
Output isn't correct |
10 |
Incorrect |
93 ms |
7776 KB |
Output isn't correct |
11 |
Incorrect |
93 ms |
8096 KB |
Output isn't correct |
12 |
Incorrect |
90 ms |
7728 KB |
Output isn't correct |
13 |
Incorrect |
122 ms |
8512 KB |
Output isn't correct |
14 |
Incorrect |
100 ms |
7720 KB |
Output isn't correct |
15 |
Incorrect |
91 ms |
7936 KB |
Output isn't correct |
16 |
Incorrect |
133 ms |
8292 KB |
Output isn't correct |
17 |
Incorrect |
121 ms |
8160 KB |
Output isn't correct |
18 |
Incorrect |
118 ms |
8416 KB |
Output isn't correct |
19 |
Incorrect |
99 ms |
8160 KB |
Output isn't correct |
20 |
Incorrect |
132 ms |
8672 KB |
Output isn't correct |
21 |
Incorrect |
140 ms |
9056 KB |
Output isn't correct |
22 |
Incorrect |
132 ms |
8568 KB |
Output isn't correct |
23 |
Incorrect |
144 ms |
9056 KB |
Output isn't correct |