#include "grader.h"
#include "encoder.h"
#include <vector>
#include <iostream>
using namespace std;
int dist[1001][1001];
void encode(int nv, int nh, int ne, int *v1, int *v2){
for (int i = 0; i < nv; i++)
for (int j = 0; j < nv; j++) dist[i][j] = 1000000;
for (int i = 0; i < ne; i++) {
dist[v1[i]][v2[i]] = 1;
dist[v2[i]][v1[i]] = 1;
}
for (int i = 0; i < nv; i++) dist[i][i] = 0;
for (int k = 0; k < nv; k++)
for (int i = 0; i < nv; i++)
for (int j = 0; j < nv; j++)
if (dist[i][j] > dist[i][k] + dist[k][j]) {
dist[i][j] = dist[i][k] + dist[k][j];
}
for (int i = 0; i < nv; i++) {
for (int h = 0; h < nh; h++) {
int d = dist[i][h];
for (int b = 9; b >= 0; b--) {
encode_bit(1 & (d >> b));
}
}
}
}
#include "grader.h"
#include "decoder.h"
void decode(int nv, int nh) {
for (int i = 0; i < nv; i++) {
for (int h = 0; h < nh; h++) {
int dist = 0;
for (int b = 0; b < 10; b++) {
dist <<= 1;
dist += decode_bit();
}
hops(h, i, dist);
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
826 ms |
22484 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
2 ms |
14080 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
541 ms |
17804 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
2 ms |
14084 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
533 ms |
17832 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
722 ms |
20388 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
724 ms |
20340 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
643 ms |
20440 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
696 ms |
20448 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
694 ms |
20348 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
692 ms |
20644 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
704 ms |
20236 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
706 ms |
20380 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
694 ms |
20248 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
717 ms |
20368 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
715 ms |
20400 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
725 ms |
20480 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
717 ms |
20404 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
720 ms |
20316 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
719 ms |
22588 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
761 ms |
22464 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
720 ms |
20360 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
735 ms |
22588 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
826 ms |
22484 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
2 ms |
14080 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
541 ms |
17804 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
2 ms |
14084 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
533 ms |
17832 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
722 ms |
20388 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
724 ms |
20340 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
643 ms |
20440 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
696 ms |
20448 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
694 ms |
20348 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
692 ms |
20644 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
704 ms |
20236 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
706 ms |
20380 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
694 ms |
20248 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
717 ms |
20368 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
715 ms |
20400 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
725 ms |
20480 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
717 ms |
20404 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
720 ms |
20316 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
719 ms |
22588 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
761 ms |
22464 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
720 ms |
20360 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
735 ms |
22588 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
826 ms |
22484 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
2 ms |
14080 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
541 ms |
17804 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
2 ms |
14084 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
533 ms |
17832 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
722 ms |
20388 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
724 ms |
20340 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
643 ms |
20440 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
696 ms |
20448 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
694 ms |
20348 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
692 ms |
20644 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
704 ms |
20236 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
706 ms |
20380 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
694 ms |
20248 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
717 ms |
20368 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
715 ms |
20400 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
725 ms |
20480 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
717 ms |
20404 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
720 ms |
20316 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
719 ms |
22588 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
761 ms |
22464 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
720 ms |
20360 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
735 ms |
22588 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
826 ms |
22484 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
2 ms |
14080 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
541 ms |
17804 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
2 ms |
14084 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
533 ms |
17832 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
722 ms |
20388 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
724 ms |
20340 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
643 ms |
20440 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
696 ms |
20448 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
694 ms |
20348 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
692 ms |
20644 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
704 ms |
20236 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
706 ms |
20380 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
694 ms |
20248 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
717 ms |
20368 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
715 ms |
20400 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
725 ms |
20480 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
717 ms |
20404 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
720 ms |
20316 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
719 ms |
22588 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
761 ms |
22464 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
720 ms |
20360 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
735 ms |
22588 KB |
Output is partially correct - 360000 call(s) of encode_bit() |