#include "grader.h"
#include "encoder.h"
#include<bits/stdc++.h>
using namespace std;
int gr[1001][1001];
string bi(int x){
string cmp;
while(x){
if(x % 2 ==0){
cmp += '0';
}
else{
cmp += '1';
}
x /= 2;
}
while(cmp.size() < 10){
cmp += '0';
}
return cmp;
}
void encode(int nv, int nh, int ne, int *v1, int *v2){
string s;
for(int i = 0 ; i < 1001 ; i++){
for(int j = 0 ; j< 1001 ; j++){
gr[i][j] = 3000;
}
}
for(int i = 0 ; i < ne ; i++){
gr[v1[i]][v2[i]] = 1;
gr[v2[i]][v1[i]] = 1;
}
for(int k = 0 ; k < 1001 ; k++){
for(int i = 0 ; i < 1001 ; i++ ){
for(int j = 0 ; j < 1001 ; j++){
if(i == j){
gr[i][j] = 0;
continue;
}
if(gr[i][j] > gr[i][k] + gr[k][j]){
gr[i][j] = gr[i][k] + gr[k][j];
}
}
}
}
for(int i = 0 ; i < nh ; i++){
for(int j = 0 ; j < nv ; j++){
s = bi(gr[i][j]);
for(int k = 0 ; k < s.size() ; k++){
encode_bit(s[k] - '0');
}
}
}
// encode_bit(1);
// encode_bit(0);
return;
}
#include "grader.h"
#include "encoder.h"
#include<bits/stdc++.h>
using namespace std;
void decode(int nv, int nh) {
int rechner = 0;
for(int i = 0 ; i < nh ; i++){
for(int j = 0 ; j < nv ; j++){
rechner = 0;
for(int k = 1; k < 1024 ; k *= 2){
rechner += k *decode_bit();
}
hops(i , j , rechner);
}
}
// hops(0,0,0);
// hops(1,2,3);
}
Compilation message
encoder.cpp: In function 'void encode(int, int, int, int*, int*)':
encoder.cpp:49:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
49 | for(int k = 0 ; k < s.size() ; k++){
| ~~^~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1014 ms |
13360 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
839 ms |
8408 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
970 ms |
11132 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
804 ms |
8484 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
904 ms |
11288 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
948 ms |
11440 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
1026 ms |
11720 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
981 ms |
11400 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
1012 ms |
11380 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
881 ms |
11364 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
954 ms |
11440 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
951 ms |
11448 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
915 ms |
11664 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
901 ms |
11396 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
891 ms |
11444 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
892 ms |
11668 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
942 ms |
11708 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
875 ms |
11804 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
867 ms |
11512 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
875 ms |
11868 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
874 ms |
11840 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
893 ms |
11620 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
890 ms |
11980 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1014 ms |
13360 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
839 ms |
8408 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
970 ms |
11132 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
804 ms |
8484 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
904 ms |
11288 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
948 ms |
11440 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
1026 ms |
11720 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
981 ms |
11400 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
1012 ms |
11380 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
881 ms |
11364 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
954 ms |
11440 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
951 ms |
11448 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
915 ms |
11664 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
901 ms |
11396 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
891 ms |
11444 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
892 ms |
11668 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
942 ms |
11708 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
875 ms |
11804 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
867 ms |
11512 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
875 ms |
11868 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
874 ms |
11840 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
893 ms |
11620 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
890 ms |
11980 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1014 ms |
13360 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
839 ms |
8408 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
970 ms |
11132 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
804 ms |
8484 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
904 ms |
11288 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
948 ms |
11440 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
1026 ms |
11720 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
981 ms |
11400 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
1012 ms |
11380 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
881 ms |
11364 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
954 ms |
11440 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
951 ms |
11448 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
915 ms |
11664 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
901 ms |
11396 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
891 ms |
11444 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
892 ms |
11668 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
942 ms |
11708 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
875 ms |
11804 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
867 ms |
11512 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
875 ms |
11868 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
874 ms |
11840 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
893 ms |
11620 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
890 ms |
11980 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1014 ms |
13360 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
839 ms |
8408 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
970 ms |
11132 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
804 ms |
8484 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
904 ms |
11288 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
948 ms |
11440 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
1026 ms |
11720 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
981 ms |
11400 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
1012 ms |
11380 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
881 ms |
11364 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
954 ms |
11440 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
951 ms |
11448 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
915 ms |
11664 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
901 ms |
11396 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
891 ms |
11444 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
892 ms |
11668 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
942 ms |
11708 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
875 ms |
11804 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
867 ms |
11512 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
875 ms |
11868 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
874 ms |
11840 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
893 ms |
11620 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
890 ms |
11980 KB |
Output is partially correct - 360000 call(s) of encode_bit() |