#include <bits/stdc++.h>
#include "grader.h"
#include "encoder.h"
using namespace std;
vector<int>D[1009];
vector<int>XD[1009];
int zaj[40][1009];
int vv1[7],vv2[7];
void encode(int nv, int nh, int ne, int *v1, int *v2)
{
for(int i=0;i<ne;i++)
{
int a=v1[i];
int b=v2[i];
D[a].push_back(b);
D[b].push_back(a);
}
for(int l=0;l<nh;l++)
{
XD[0].push_back(l);
zaj[l][l]=1;
for(int i=1;true;i++)
{
for(int j=0;j<XD[i-1].size();j++)
{
int ziom=XD[i-1][j];
for(int k=0;k<D[ziom].size();k++)
{
int somsiad=D[ziom][k];
if(zaj[l][somsiad]==0)
{
zaj[l][somsiad]=i;
XD[i].push_back(somsiad);
}
}
}
if(XD[i-1].size()==0){zaj[l][l]=0;break;}
XD[i-1].clear();
}
}
vector<int>A;
for(int i=nh-1;i>=0;i--)
{
for(int j=nv-1;j>=0;j--)
{
int u=zaj[i][j];
for(int k=1;k<=10;k++)
{
A.push_back(u%2);
u=u/2;
}
}
}
reverse(A.begin(),A.end());
for(int i=0;i<A.size();i++)
{
encode_bit(A[i]);
}
}
/**int main()
{ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
vv1[0]=0;vv2[0]=1;
vv1[1]=0;vv2[1]=2;
vv1[2]=0;vv2[2]=4;
vv1[3]=2;vv2[3]=1;
vv1[4]=3;vv2[4]=1;
vv1[5]=0;vv2[5]=3;
vv1[6]=1;vv2[6]=4;
encode(5,3,7,vv1,vv2);
return 0;
}**/
#include <bits/stdc++.h>
#include "grader.h"
#include "encoder.h"
using namespace std;
void decode(int nv, int nh)
{
int a=decode_bit();
int b=decode_bit();
for(int i=0;i<nh;i++)
{
for(int j=0;j<nv;j++)
{
int u=0;
for(int k=1;k<=10;k++)
{
u=(u*2)+decode_bit();
}
hops(i,j,u);
}
}
}
Compilation message
encoder.cpp: In function 'void encode(int, int, int, int*, int*)':
encoder.cpp:24:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
24 | for(int j=0;j<XD[i-1].size();j++)
| ~^~~~~~~~~~~~~~~
encoder.cpp:27:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
27 | for(int k=0;k<D[ziom].size();k++)
| ~^~~~~~~~~~~~~~~
encoder.cpp:55:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
55 | for(int i=0;i<A.size();i++)
| ~^~~~~~~~~
decoder.cpp: In function 'void decode(int, int)':
decoder.cpp:7:8: warning: unused variable 'a' [-Wunused-variable]
7 | int a=decode_bit();
| ^
decoder.cpp:8:8: warning: unused variable 'b' [-Wunused-variable]
8 | int b=decode_bit();
| ^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
222 ms |
14124 KB |
too many decode_bit() calls |
2 |
Incorrect |
3 ms |
4580 KB |
wrong parameter |
3 |
Incorrect |
70 ms |
8808 KB |
too many decode_bit() calls |
4 |
Incorrect |
2 ms |
4580 KB |
wrong parameter |
5 |
Incorrect |
72 ms |
8928 KB |
too many decode_bit() calls |
6 |
Incorrect |
94 ms |
9340 KB |
too many decode_bit() calls |
7 |
Incorrect |
116 ms |
9720 KB |
too many decode_bit() calls |
8 |
Incorrect |
74 ms |
8960 KB |
too many decode_bit() calls |
9 |
Incorrect |
93 ms |
9188 KB |
too many decode_bit() calls |
10 |
Incorrect |
81 ms |
9244 KB |
too many decode_bit() calls |
11 |
Incorrect |
97 ms |
9352 KB |
too many decode_bit() calls |
12 |
Incorrect |
69 ms |
9132 KB |
wrong parameter |
13 |
Incorrect |
130 ms |
9924 KB |
too many decode_bit() calls |
14 |
Incorrect |
98 ms |
9312 KB |
wrong parameter |
15 |
Incorrect |
74 ms |
9340 KB |
wrong parameter |
16 |
Incorrect |
107 ms |
9712 KB |
wrong parameter |
17 |
Incorrect |
113 ms |
9764 KB |
wrong parameter |
18 |
Incorrect |
96 ms |
9988 KB |
too many decode_bit() calls |
19 |
Incorrect |
80 ms |
9628 KB |
too many decode_bit() calls |
20 |
Incorrect |
128 ms |
10356 KB |
too many decode_bit() calls |
21 |
Incorrect |
131 ms |
10448 KB |
too many decode_bit() calls |
22 |
Incorrect |
120 ms |
9848 KB |
too many decode_bit() calls |
23 |
Incorrect |
154 ms |
10632 KB |
too many decode_bit() calls |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
222 ms |
14124 KB |
too many decode_bit() calls |
2 |
Incorrect |
3 ms |
4580 KB |
wrong parameter |
3 |
Incorrect |
70 ms |
8808 KB |
too many decode_bit() calls |
4 |
Incorrect |
2 ms |
4580 KB |
wrong parameter |
5 |
Incorrect |
72 ms |
8928 KB |
too many decode_bit() calls |
6 |
Incorrect |
94 ms |
9340 KB |
too many decode_bit() calls |
7 |
Incorrect |
116 ms |
9720 KB |
too many decode_bit() calls |
8 |
Incorrect |
74 ms |
8960 KB |
too many decode_bit() calls |
9 |
Incorrect |
93 ms |
9188 KB |
too many decode_bit() calls |
10 |
Incorrect |
81 ms |
9244 KB |
too many decode_bit() calls |
11 |
Incorrect |
97 ms |
9352 KB |
too many decode_bit() calls |
12 |
Incorrect |
69 ms |
9132 KB |
wrong parameter |
13 |
Incorrect |
130 ms |
9924 KB |
too many decode_bit() calls |
14 |
Incorrect |
98 ms |
9312 KB |
wrong parameter |
15 |
Incorrect |
74 ms |
9340 KB |
wrong parameter |
16 |
Incorrect |
107 ms |
9712 KB |
wrong parameter |
17 |
Incorrect |
113 ms |
9764 KB |
wrong parameter |
18 |
Incorrect |
96 ms |
9988 KB |
too many decode_bit() calls |
19 |
Incorrect |
80 ms |
9628 KB |
too many decode_bit() calls |
20 |
Incorrect |
128 ms |
10356 KB |
too many decode_bit() calls |
21 |
Incorrect |
131 ms |
10448 KB |
too many decode_bit() calls |
22 |
Incorrect |
120 ms |
9848 KB |
too many decode_bit() calls |
23 |
Incorrect |
154 ms |
10632 KB |
too many decode_bit() calls |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
222 ms |
14124 KB |
too many decode_bit() calls |
2 |
Incorrect |
3 ms |
4580 KB |
wrong parameter |
3 |
Incorrect |
70 ms |
8808 KB |
too many decode_bit() calls |
4 |
Incorrect |
2 ms |
4580 KB |
wrong parameter |
5 |
Incorrect |
72 ms |
8928 KB |
too many decode_bit() calls |
6 |
Incorrect |
94 ms |
9340 KB |
too many decode_bit() calls |
7 |
Incorrect |
116 ms |
9720 KB |
too many decode_bit() calls |
8 |
Incorrect |
74 ms |
8960 KB |
too many decode_bit() calls |
9 |
Incorrect |
93 ms |
9188 KB |
too many decode_bit() calls |
10 |
Incorrect |
81 ms |
9244 KB |
too many decode_bit() calls |
11 |
Incorrect |
97 ms |
9352 KB |
too many decode_bit() calls |
12 |
Incorrect |
69 ms |
9132 KB |
wrong parameter |
13 |
Incorrect |
130 ms |
9924 KB |
too many decode_bit() calls |
14 |
Incorrect |
98 ms |
9312 KB |
wrong parameter |
15 |
Incorrect |
74 ms |
9340 KB |
wrong parameter |
16 |
Incorrect |
107 ms |
9712 KB |
wrong parameter |
17 |
Incorrect |
113 ms |
9764 KB |
wrong parameter |
18 |
Incorrect |
96 ms |
9988 KB |
too many decode_bit() calls |
19 |
Incorrect |
80 ms |
9628 KB |
too many decode_bit() calls |
20 |
Incorrect |
128 ms |
10356 KB |
too many decode_bit() calls |
21 |
Incorrect |
131 ms |
10448 KB |
too many decode_bit() calls |
22 |
Incorrect |
120 ms |
9848 KB |
too many decode_bit() calls |
23 |
Incorrect |
154 ms |
10632 KB |
too many decode_bit() calls |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
222 ms |
14124 KB |
too many decode_bit() calls |
2 |
Incorrect |
3 ms |
4580 KB |
wrong parameter |
3 |
Incorrect |
70 ms |
8808 KB |
too many decode_bit() calls |
4 |
Incorrect |
2 ms |
4580 KB |
wrong parameter |
5 |
Incorrect |
72 ms |
8928 KB |
too many decode_bit() calls |
6 |
Incorrect |
94 ms |
9340 KB |
too many decode_bit() calls |
7 |
Incorrect |
116 ms |
9720 KB |
too many decode_bit() calls |
8 |
Incorrect |
74 ms |
8960 KB |
too many decode_bit() calls |
9 |
Incorrect |
93 ms |
9188 KB |
too many decode_bit() calls |
10 |
Incorrect |
81 ms |
9244 KB |
too many decode_bit() calls |
11 |
Incorrect |
97 ms |
9352 KB |
too many decode_bit() calls |
12 |
Incorrect |
69 ms |
9132 KB |
wrong parameter |
13 |
Incorrect |
130 ms |
9924 KB |
too many decode_bit() calls |
14 |
Incorrect |
98 ms |
9312 KB |
wrong parameter |
15 |
Incorrect |
74 ms |
9340 KB |
wrong parameter |
16 |
Incorrect |
107 ms |
9712 KB |
wrong parameter |
17 |
Incorrect |
113 ms |
9764 KB |
wrong parameter |
18 |
Incorrect |
96 ms |
9988 KB |
too many decode_bit() calls |
19 |
Incorrect |
80 ms |
9628 KB |
too many decode_bit() calls |
20 |
Incorrect |
128 ms |
10356 KB |
too many decode_bit() calls |
21 |
Incorrect |
131 ms |
10448 KB |
too many decode_bit() calls |
22 |
Incorrect |
120 ms |
9848 KB |
too many decode_bit() calls |
23 |
Incorrect |
154 ms |
10632 KB |
too many decode_bit() calls |