#include <bits/stdc++.h>
using namespace std;
#include "grader.h"
#include "encoder.h"
void encode(int n,int h,int p,int a[],int b[]) {
int grid[1005][1005];
for (int i=0;i<n;i++) {
for (int j=0;j<n;j++) {
grid[i][j]=2000;
}
grid[i][i]=0;
}
for (int i=0;i<p;i++) {
grid[a[i]][b[i]]=1;
grid[b[i]][a[i]]=1;
}
for (int k=0;k<n;k++)
for (int i=0;i<n;i++) {
for (int j=0;j<n;j++) {
int tmp=grid[i][k]+grid[k][j];
if (i!=j && grid[i][j]>tmp) grid[i][j]=tmp;
}
}
for (int i=0;i<h;i++) {
for (int j=0;j<n;j++) {
int nm=grid[i][j];
for (int pp=0;pp<10;pp++) {
if (((1<<pp)&nm)==0) encode_bit(0);
else encode_bit(1);
}
}
}
}
#include <bits/stdc++.h>
using namespace std;
#include "grader.h"
#include "encoder.h"
void decode(int n,int h) {
for (int i=0;i<h;i++) {
for (int j=0;j<n;j++) {
int nm=0;
for (int p=0;p<10;p++) {
nm+=((1<<p)*decode_bit());
}
hops(i,j,nm);
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1266 ms |
13412 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
4 ms |
8452 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
879 ms |
11156 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
4 ms |
8588 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
895 ms |
11216 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
1178 ms |
11416 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
1172 ms |
11616 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
1041 ms |
11404 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
1144 ms |
11400 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
1169 ms |
11416 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
1155 ms |
11508 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
1177 ms |
11400 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
1180 ms |
11780 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
1172 ms |
11376 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
1168 ms |
11556 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
1159 ms |
11660 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
1181 ms |
11664 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
1207 ms |
11748 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
1135 ms |
11516 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
1136 ms |
11892 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
1170 ms |
11876 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
1150 ms |
11800 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
1176 ms |
12004 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1266 ms |
13412 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
4 ms |
8452 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
879 ms |
11156 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
4 ms |
8588 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
895 ms |
11216 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
1178 ms |
11416 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
1172 ms |
11616 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
1041 ms |
11404 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
1144 ms |
11400 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
1169 ms |
11416 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
1155 ms |
11508 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
1177 ms |
11400 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
1180 ms |
11780 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
1172 ms |
11376 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
1168 ms |
11556 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
1159 ms |
11660 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
1181 ms |
11664 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
1207 ms |
11748 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
1135 ms |
11516 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
1136 ms |
11892 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
1170 ms |
11876 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
1150 ms |
11800 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
1176 ms |
12004 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1266 ms |
13412 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
4 ms |
8452 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
879 ms |
11156 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
4 ms |
8588 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
895 ms |
11216 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
1178 ms |
11416 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
1172 ms |
11616 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
1041 ms |
11404 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
1144 ms |
11400 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
1169 ms |
11416 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
1155 ms |
11508 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
1177 ms |
11400 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
1180 ms |
11780 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
1172 ms |
11376 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
1168 ms |
11556 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
1159 ms |
11660 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
1181 ms |
11664 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
1207 ms |
11748 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
1135 ms |
11516 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
1136 ms |
11892 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
1170 ms |
11876 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
1150 ms |
11800 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
1176 ms |
12004 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1266 ms |
13412 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
4 ms |
8452 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
879 ms |
11156 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
4 ms |
8588 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
895 ms |
11216 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
1178 ms |
11416 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
1172 ms |
11616 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
1041 ms |
11404 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
1144 ms |
11400 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
1169 ms |
11416 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
1155 ms |
11508 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
1177 ms |
11400 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
1180 ms |
11780 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
1172 ms |
11376 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
1168 ms |
11556 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
1159 ms |
11660 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
1181 ms |
11664 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
1207 ms |
11748 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
1135 ms |
11516 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
1136 ms |
11892 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
1170 ms |
11876 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
1150 ms |
11800 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
1176 ms |
12004 KB |
Output is partially correct - 360000 call(s) of encode_bit() |