#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);
}
}
#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 |= (decode_bit() * (1<<k));
hops(i,j,val);
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
392 ms |
12732 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
3 ms |
4752 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
95 ms |
7420 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
3 ms |
4744 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
80 ms |
7648 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
99 ms |
8032 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
109 ms |
8416 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
87 ms |
7648 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
92 ms |
7832 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
99 ms |
7776 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
100 ms |
7776 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
91 ms |
7900 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
123 ms |
8476 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
91 ms |
7776 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
104 ms |
7776 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
117 ms |
8288 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
121 ms |
8420 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
136 ms |
8776 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
122 ms |
8400 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
138 ms |
8880 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
124 ms |
8904 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
146 ms |
8288 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
168 ms |
9240 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
392 ms |
12732 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
3 ms |
4752 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
95 ms |
7420 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
3 ms |
4744 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
80 ms |
7648 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
99 ms |
8032 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
109 ms |
8416 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
87 ms |
7648 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
92 ms |
7832 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
99 ms |
7776 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
100 ms |
7776 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
91 ms |
7900 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
123 ms |
8476 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
91 ms |
7776 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
104 ms |
7776 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
117 ms |
8288 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
121 ms |
8420 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
136 ms |
8776 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
122 ms |
8400 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
138 ms |
8880 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
124 ms |
8904 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
146 ms |
8288 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
168 ms |
9240 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
392 ms |
12732 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
3 ms |
4752 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
95 ms |
7420 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
3 ms |
4744 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
80 ms |
7648 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
99 ms |
8032 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
109 ms |
8416 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
87 ms |
7648 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
92 ms |
7832 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
99 ms |
7776 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
100 ms |
7776 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
91 ms |
7900 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
123 ms |
8476 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
91 ms |
7776 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
104 ms |
7776 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
117 ms |
8288 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
121 ms |
8420 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
136 ms |
8776 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
122 ms |
8400 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
138 ms |
8880 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
124 ms |
8904 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
146 ms |
8288 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
168 ms |
9240 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
392 ms |
12732 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
3 ms |
4752 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
95 ms |
7420 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
3 ms |
4744 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
80 ms |
7648 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
99 ms |
8032 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
109 ms |
8416 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
87 ms |
7648 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
92 ms |
7832 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
99 ms |
7776 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
100 ms |
7776 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
91 ms |
7900 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
123 ms |
8476 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
91 ms |
7776 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
104 ms |
7776 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
117 ms |
8288 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
121 ms |
8420 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
136 ms |
8776 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
122 ms |
8400 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
138 ms |
8880 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
124 ms |
8904 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
146 ms |
8288 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
168 ms |
9240 KB |
Output is partially correct - 360000 call(s) of encode_bit() |