#include "grader.h"
#include "encoder.h"
#include <bits/stdc++.h>
using namespace std;
int dst[44][1010];
vector<int> g[1010];
void bfs(int st){
dst[st][st] = 0;
queue<int> q; q.push(st);
while(q.size()){
int now = q.front(); q.pop();
for(auto nxt : g[now]) if(dst[st][nxt] == -1){
dst[st][nxt] = dst[st][now] + 1;
q.push(nxt);
}
}
}
void encode(int N, int H, int M, int *v1, int *v2){
// encode_bit(1);
// encode_bit(0);
// return;
int n = N, m = M, h = H;
for(int i=0; i<m; i++){
int s = v1[i] + 1, e = v2[i] + 1;
g[s].push_back(e); g[e].push_back(s);
}
memset(dst, -1, sizeof dst);
for(int i=1; i<=h; i++) bfs(i);
for(int i=1; i<=h; i++) for(int j=1; j<=n; j++){
for(int k=0; k<10; k++) encode_bit(!!(dst[i][j] & (1 << k)));
}
}
//g++ grader.h grader.cpp encoder.h encoder.cpp decoder.h decoder.cpp -o main -std=c++14
#include "grader.h"
#include "decoder.h"
#include <bits/stdc++.h>
using namespace std;
void decode(int N, int H) {
// int a = decode_bit();
// int b = decode_bit();
// hops(0,0,0);
// hops(1,2,3);
int n = N, h = H;
for(int i=1; i<=h; i++) for(int j=1; j<=n; j++){
int t = 0;
for(int k=0; k<10; k++) t += decode_bit() << k;
hops(i-1, j-1, t);
}
}
//g++ grader.h grader.cpp encoder.h encoder.cpp decoder.h decoder.cpp -o main -std=c++14
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
363 ms |
14016 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
11 ms |
4864 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
87 ms |
7552 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
12 ms |
5004 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
90 ms |
7988 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
93 ms |
8184 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
112 ms |
8600 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
91 ms |
7776 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
95 ms |
7964 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
98 ms |
7928 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
97 ms |
8256 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
95 ms |
7928 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
139 ms |
8716 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
95 ms |
7928 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
105 ms |
7996 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
118 ms |
8520 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
125 ms |
8512 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
122 ms |
8688 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
123 ms |
8416 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
140 ms |
8980 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
182 ms |
9100 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
140 ms |
8568 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
142 ms |
9424 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
363 ms |
14016 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
11 ms |
4864 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
87 ms |
7552 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
12 ms |
5004 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
90 ms |
7988 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
93 ms |
8184 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
112 ms |
8600 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
91 ms |
7776 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
95 ms |
7964 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
98 ms |
7928 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
97 ms |
8256 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
95 ms |
7928 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
139 ms |
8716 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
95 ms |
7928 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
105 ms |
7996 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
118 ms |
8520 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
125 ms |
8512 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
122 ms |
8688 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
123 ms |
8416 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
140 ms |
8980 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
182 ms |
9100 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
140 ms |
8568 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
142 ms |
9424 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
363 ms |
14016 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
11 ms |
4864 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
87 ms |
7552 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
12 ms |
5004 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
90 ms |
7988 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
93 ms |
8184 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
112 ms |
8600 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
91 ms |
7776 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
95 ms |
7964 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
98 ms |
7928 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
97 ms |
8256 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
95 ms |
7928 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
139 ms |
8716 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
95 ms |
7928 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
105 ms |
7996 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
118 ms |
8520 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
125 ms |
8512 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
122 ms |
8688 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
123 ms |
8416 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
140 ms |
8980 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
182 ms |
9100 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
140 ms |
8568 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
142 ms |
9424 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
363 ms |
14016 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
11 ms |
4864 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
87 ms |
7552 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
12 ms |
5004 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
90 ms |
7988 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
93 ms |
8184 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
112 ms |
8600 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
91 ms |
7776 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
95 ms |
7964 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
98 ms |
7928 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
97 ms |
8256 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
95 ms |
7928 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
139 ms |
8716 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
95 ms |
7928 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
105 ms |
7996 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
118 ms |
8520 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
125 ms |
8512 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
122 ms |
8688 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
123 ms |
8416 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
140 ms |
8980 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
182 ms |
9100 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
140 ms |
8568 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
142 ms |
9424 KB |
Output is partially correct - 360000 call(s) of encode_bit() |