#include "grader.h"
#include "encoder.h"
#include <bits/stdc++.h>
using namespace std;
const int INF = (int)(1e9);
int d[1005];
vector<int> vec[1005];
void encode(int nv, int nh, int ne, int *v1, int *v2){
for (int i = 0; i < ne; ++i)
{
vec[v1[i]].push_back(v2[i]);
vec[v2[i]].push_back(v1[i]);
}
for (int i = 0; i < nh; ++i)
{
for (int j = 0; j < nv; ++j)d[j]=INF;
queue<int> q;
q.push(i);
d[i]=0;
while(!q.empty()){
int f=q.front();
q.pop();
for(auto it:vec[f])
if(d[it]==INF){
d[it]=d[f]+1;
q.push(it);
}
}
for (int j = i+1; j < nv; ++j)
{
assert(d[j]!=INF);
for (int z = 0; z < 10; ++z)
encode_bit((d[j]>>z)&1);
}
}
}
#include "grader.h"
#include "decoder.h"
#include <bits/stdc++.h>
using namespace std;
void decode(int nv, int nh) {
for (int i = 0; i < nh; ++i)
{
hops(i,i,0);
for (int j = i+1; j < nv; ++j)
{
int d=0;
for (int z = 0; z < 10; ++z)
d+=(1<<z)*decode_bit();
hops(i,j,d);
if(j<nh)hops(j,i,d);
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
292 ms |
13808 KB |
Output is partially correct - 353340 call(s) of encode_bit() |
2 |
Correct |
3 ms |
4804 KB |
Output is correct - 90 call(s) of encode_bit() |
3 |
Correct |
80 ms |
7296 KB |
Output is partially correct - 317340 call(s) of encode_bit() |
4 |
Correct |
3 ms |
4736 KB |
Output is correct - 100 call(s) of encode_bit() |
5 |
Correct |
83 ms |
7620 KB |
Output is partially correct - 317340 call(s) of encode_bit() |
6 |
Correct |
93 ms |
7940 KB |
Output is partially correct - 353340 call(s) of encode_bit() |
7 |
Correct |
123 ms |
8336 KB |
Output is partially correct - 353340 call(s) of encode_bit() |
8 |
Correct |
101 ms |
7544 KB |
Output is partially correct - 339300 call(s) of encode_bit() |
9 |
Correct |
102 ms |
7924 KB |
Output is partially correct - 353340 call(s) of encode_bit() |
10 |
Correct |
111 ms |
7920 KB |
Output is partially correct - 353340 call(s) of encode_bit() |
11 |
Correct |
113 ms |
7928 KB |
Output is partially correct - 353340 call(s) of encode_bit() |
12 |
Correct |
108 ms |
7672 KB |
Output is partially correct - 353340 call(s) of encode_bit() |
13 |
Correct |
114 ms |
8432 KB |
Output is partially correct - 353340 call(s) of encode_bit() |
14 |
Correct |
99 ms |
7796 KB |
Output is partially correct - 353340 call(s) of encode_bit() |
15 |
Correct |
94 ms |
7800 KB |
Output is partially correct - 353340 call(s) of encode_bit() |
16 |
Correct |
151 ms |
8296 KB |
Output is partially correct - 353340 call(s) of encode_bit() |
17 |
Correct |
122 ms |
8212 KB |
Output is partially correct - 353340 call(s) of encode_bit() |
18 |
Correct |
133 ms |
8432 KB |
Output is partially correct - 353340 call(s) of encode_bit() |
19 |
Correct |
111 ms |
8024 KB |
Output is partially correct - 353340 call(s) of encode_bit() |
20 |
Correct |
145 ms |
8824 KB |
Output is partially correct - 353340 call(s) of encode_bit() |
21 |
Correct |
160 ms |
8808 KB |
Output is partially correct - 353340 call(s) of encode_bit() |
22 |
Correct |
137 ms |
8436 KB |
Output is partially correct - 353340 call(s) of encode_bit() |
23 |
Correct |
150 ms |
9200 KB |
Output is partially correct - 353340 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
292 ms |
13808 KB |
Output is partially correct - 353340 call(s) of encode_bit() |
2 |
Correct |
3 ms |
4804 KB |
Output is correct - 90 call(s) of encode_bit() |
3 |
Correct |
80 ms |
7296 KB |
Output is partially correct - 317340 call(s) of encode_bit() |
4 |
Correct |
3 ms |
4736 KB |
Output is correct - 100 call(s) of encode_bit() |
5 |
Correct |
83 ms |
7620 KB |
Output is partially correct - 317340 call(s) of encode_bit() |
6 |
Correct |
93 ms |
7940 KB |
Output is partially correct - 353340 call(s) of encode_bit() |
7 |
Correct |
123 ms |
8336 KB |
Output is partially correct - 353340 call(s) of encode_bit() |
8 |
Correct |
101 ms |
7544 KB |
Output is partially correct - 339300 call(s) of encode_bit() |
9 |
Correct |
102 ms |
7924 KB |
Output is partially correct - 353340 call(s) of encode_bit() |
10 |
Correct |
111 ms |
7920 KB |
Output is partially correct - 353340 call(s) of encode_bit() |
11 |
Correct |
113 ms |
7928 KB |
Output is partially correct - 353340 call(s) of encode_bit() |
12 |
Correct |
108 ms |
7672 KB |
Output is partially correct - 353340 call(s) of encode_bit() |
13 |
Correct |
114 ms |
8432 KB |
Output is partially correct - 353340 call(s) of encode_bit() |
14 |
Correct |
99 ms |
7796 KB |
Output is partially correct - 353340 call(s) of encode_bit() |
15 |
Correct |
94 ms |
7800 KB |
Output is partially correct - 353340 call(s) of encode_bit() |
16 |
Correct |
151 ms |
8296 KB |
Output is partially correct - 353340 call(s) of encode_bit() |
17 |
Correct |
122 ms |
8212 KB |
Output is partially correct - 353340 call(s) of encode_bit() |
18 |
Correct |
133 ms |
8432 KB |
Output is partially correct - 353340 call(s) of encode_bit() |
19 |
Correct |
111 ms |
8024 KB |
Output is partially correct - 353340 call(s) of encode_bit() |
20 |
Correct |
145 ms |
8824 KB |
Output is partially correct - 353340 call(s) of encode_bit() |
21 |
Correct |
160 ms |
8808 KB |
Output is partially correct - 353340 call(s) of encode_bit() |
22 |
Correct |
137 ms |
8436 KB |
Output is partially correct - 353340 call(s) of encode_bit() |
23 |
Correct |
150 ms |
9200 KB |
Output is partially correct - 353340 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
292 ms |
13808 KB |
Output is partially correct - 353340 call(s) of encode_bit() |
2 |
Correct |
3 ms |
4804 KB |
Output is correct - 90 call(s) of encode_bit() |
3 |
Correct |
80 ms |
7296 KB |
Output is partially correct - 317340 call(s) of encode_bit() |
4 |
Correct |
3 ms |
4736 KB |
Output is correct - 100 call(s) of encode_bit() |
5 |
Correct |
83 ms |
7620 KB |
Output is partially correct - 317340 call(s) of encode_bit() |
6 |
Correct |
93 ms |
7940 KB |
Output is partially correct - 353340 call(s) of encode_bit() |
7 |
Correct |
123 ms |
8336 KB |
Output is partially correct - 353340 call(s) of encode_bit() |
8 |
Correct |
101 ms |
7544 KB |
Output is partially correct - 339300 call(s) of encode_bit() |
9 |
Correct |
102 ms |
7924 KB |
Output is partially correct - 353340 call(s) of encode_bit() |
10 |
Correct |
111 ms |
7920 KB |
Output is partially correct - 353340 call(s) of encode_bit() |
11 |
Correct |
113 ms |
7928 KB |
Output is partially correct - 353340 call(s) of encode_bit() |
12 |
Correct |
108 ms |
7672 KB |
Output is partially correct - 353340 call(s) of encode_bit() |
13 |
Correct |
114 ms |
8432 KB |
Output is partially correct - 353340 call(s) of encode_bit() |
14 |
Correct |
99 ms |
7796 KB |
Output is partially correct - 353340 call(s) of encode_bit() |
15 |
Correct |
94 ms |
7800 KB |
Output is partially correct - 353340 call(s) of encode_bit() |
16 |
Correct |
151 ms |
8296 KB |
Output is partially correct - 353340 call(s) of encode_bit() |
17 |
Correct |
122 ms |
8212 KB |
Output is partially correct - 353340 call(s) of encode_bit() |
18 |
Correct |
133 ms |
8432 KB |
Output is partially correct - 353340 call(s) of encode_bit() |
19 |
Correct |
111 ms |
8024 KB |
Output is partially correct - 353340 call(s) of encode_bit() |
20 |
Correct |
145 ms |
8824 KB |
Output is partially correct - 353340 call(s) of encode_bit() |
21 |
Correct |
160 ms |
8808 KB |
Output is partially correct - 353340 call(s) of encode_bit() |
22 |
Correct |
137 ms |
8436 KB |
Output is partially correct - 353340 call(s) of encode_bit() |
23 |
Correct |
150 ms |
9200 KB |
Output is partially correct - 353340 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
292 ms |
13808 KB |
Output is partially correct - 353340 call(s) of encode_bit() |
2 |
Correct |
3 ms |
4804 KB |
Output is correct - 90 call(s) of encode_bit() |
3 |
Correct |
80 ms |
7296 KB |
Output is partially correct - 317340 call(s) of encode_bit() |
4 |
Correct |
3 ms |
4736 KB |
Output is correct - 100 call(s) of encode_bit() |
5 |
Correct |
83 ms |
7620 KB |
Output is partially correct - 317340 call(s) of encode_bit() |
6 |
Correct |
93 ms |
7940 KB |
Output is partially correct - 353340 call(s) of encode_bit() |
7 |
Correct |
123 ms |
8336 KB |
Output is partially correct - 353340 call(s) of encode_bit() |
8 |
Correct |
101 ms |
7544 KB |
Output is partially correct - 339300 call(s) of encode_bit() |
9 |
Correct |
102 ms |
7924 KB |
Output is partially correct - 353340 call(s) of encode_bit() |
10 |
Correct |
111 ms |
7920 KB |
Output is partially correct - 353340 call(s) of encode_bit() |
11 |
Correct |
113 ms |
7928 KB |
Output is partially correct - 353340 call(s) of encode_bit() |
12 |
Correct |
108 ms |
7672 KB |
Output is partially correct - 353340 call(s) of encode_bit() |
13 |
Correct |
114 ms |
8432 KB |
Output is partially correct - 353340 call(s) of encode_bit() |
14 |
Correct |
99 ms |
7796 KB |
Output is partially correct - 353340 call(s) of encode_bit() |
15 |
Correct |
94 ms |
7800 KB |
Output is partially correct - 353340 call(s) of encode_bit() |
16 |
Correct |
151 ms |
8296 KB |
Output is partially correct - 353340 call(s) of encode_bit() |
17 |
Correct |
122 ms |
8212 KB |
Output is partially correct - 353340 call(s) of encode_bit() |
18 |
Correct |
133 ms |
8432 KB |
Output is partially correct - 353340 call(s) of encode_bit() |
19 |
Correct |
111 ms |
8024 KB |
Output is partially correct - 353340 call(s) of encode_bit() |
20 |
Correct |
145 ms |
8824 KB |
Output is partially correct - 353340 call(s) of encode_bit() |
21 |
Correct |
160 ms |
8808 KB |
Output is partially correct - 353340 call(s) of encode_bit() |
22 |
Correct |
137 ms |
8436 KB |
Output is partially correct - 353340 call(s) of encode_bit() |
23 |
Correct |
150 ms |
9200 KB |
Output is partially correct - 353340 call(s) of encode_bit() |