#include "grader.h"
#include "encoder.h"
#include <bits/stdc++.h>
void encodeNum(int x) {
for(int i = 0; i < 10; i++)
encode_bit((bool)(x&1<<i));
}
void encode(int N, int H, int P, int A[], int B[]){
int dis[N][N];
memset(dis, 1, sizeof dis);
for(int i = 0; i < P; i++) dis[A[i]][B[i]] = dis[B[i]][A[i]] = 1;
for(int i = 0; i < N; i++) dis[i][i] = 0;
for(int k = 0; k < N; k++)
for(int i = 0; i < N; i++)
for(int j = 0; j < N; j++)
dis[i][j] = std::min(dis[i][j], dis[i][k]+dis[k][j]);
for(int i = 0; i < H; i++)
for(int j = 0; j < N; j++)
encodeNum(dis[i][j]);
}
#include "grader.h"
#include "decoder.h"
int getNum() {
int res = 0;
for(int i = 0; i < 10; i++)
res+=(1<<i)*decode_bit();
return res;
}
void decode(int N, int H){
for(int i = 0; i < H; i++)
for(int j = 0; j < N; j++)
hops(i,j,getNum());
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1131 ms |
13324 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
2 ms |
4608 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
670 ms |
10368 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
3 ms |
4604 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
761 ms |
10420 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
901 ms |
11464 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
975 ms |
11532 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
812 ms |
11012 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
953 ms |
11376 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
976 ms |
11380 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
911 ms |
11444 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
949 ms |
11312 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
1055 ms |
11760 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
937 ms |
11408 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
995 ms |
11508 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
974 ms |
11616 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
996 ms |
11560 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
944 ms |
11644 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
946 ms |
11512 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
957 ms |
11744 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
960 ms |
11840 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
927 ms |
11624 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
969 ms |
11984 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1131 ms |
13324 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
2 ms |
4608 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
670 ms |
10368 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
3 ms |
4604 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
761 ms |
10420 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
901 ms |
11464 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
975 ms |
11532 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
812 ms |
11012 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
953 ms |
11376 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
976 ms |
11380 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
911 ms |
11444 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
949 ms |
11312 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
1055 ms |
11760 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
937 ms |
11408 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
995 ms |
11508 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
974 ms |
11616 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
996 ms |
11560 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
944 ms |
11644 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
946 ms |
11512 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
957 ms |
11744 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
960 ms |
11840 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
927 ms |
11624 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
969 ms |
11984 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1131 ms |
13324 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
2 ms |
4608 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
670 ms |
10368 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
3 ms |
4604 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
761 ms |
10420 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
901 ms |
11464 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
975 ms |
11532 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
812 ms |
11012 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
953 ms |
11376 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
976 ms |
11380 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
911 ms |
11444 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
949 ms |
11312 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
1055 ms |
11760 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
937 ms |
11408 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
995 ms |
11508 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
974 ms |
11616 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
996 ms |
11560 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
944 ms |
11644 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
946 ms |
11512 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
957 ms |
11744 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
960 ms |
11840 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
927 ms |
11624 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
969 ms |
11984 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1131 ms |
13324 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
2 ms |
4608 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
670 ms |
10368 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
3 ms |
4604 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
761 ms |
10420 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
901 ms |
11464 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
975 ms |
11532 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
812 ms |
11012 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
953 ms |
11376 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
976 ms |
11380 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
911 ms |
11444 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
949 ms |
11312 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
1055 ms |
11760 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
937 ms |
11408 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
995 ms |
11508 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
974 ms |
11616 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
996 ms |
11560 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
944 ms |
11644 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
946 ms |
11512 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
957 ms |
11744 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
960 ms |
11840 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
927 ms |
11624 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
969 ms |
11984 KB |
Output is partially correct - 360000 call(s) of encode_bit() |