#include "grader.h"
#include "encoder.h"
#include<bits/stdc++.h>
using namespace std;
const int M = 1e4+5;
vector<vector<int>> node(M, vector<int>({}));
vector<int> vis(M, 0), dist(M, 0);
void bfs(int s) {
queue<int> q;
q.push(s);
vis[s] = true;
while (!q.empty()) {
int f = q.front(); q.pop();
for (int i:node[f]) {
if (!vis[i]) {
vis[i] = true;
dist[i] = dist[f]+1;
q.push(i);
}
}
}
}
void encode(int n, int h, int p, int *a, int *b){
for (int i = 0; i < p; i++) {
node[a[i]].push_back(b[i]);
node[b[i]].push_back(a[i]);
}
map<pair<int, int>, int> ans;
for (int i = 0; i < h; i++) {
for (int j = 0; j < n; j++) dist[j] = vis[j] = 0;
bfs(i);
for (int j = i+1; j < n; j++) ans[{i, j}] = dist[j];
}
for (int i = 0; i < h; i++) {
for (int j = i+1; j < n; j++) {
for (int k = 0; k < 10; k++) {
encode_bit((ans[{i, j}]&(1<<k))!=0);
}
}
}
return;
}
#include "grader.h"
#include "decoder.h"
#include<bits/stdc++.h>
using namespace std;
void decode(int n, int h) {
vector<vector<int>> pp(h, vector<int>(n, 0));
for (int i = 0; i < h; i++) {
for (int j = i+1; j < n; j++) {
for (int k = 0; k < 10; k++) {
pp[i][j] += decode_bit()*(1<<k);
}
}
}
for (int i = 0; i < h; i++) {
hops(i, i, 0);
for (int j = i+1; j < n; j++) {
hops(i, j, pp[i][j]);
hops(j, i, pp[i][j]);
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
267 ms |
14668 KB |
wrong parameter |
2 |
Incorrect |
3 ms |
4880 KB |
wrong parameter |
3 |
Incorrect |
92 ms |
9688 KB |
wrong parameter |
4 |
Correct |
4 ms |
4848 KB |
Output is correct - 100 call(s) of encode_bit() |
5 |
Incorrect |
88 ms |
9812 KB |
wrong parameter |
6 |
Incorrect |
112 ms |
10236 KB |
wrong parameter |
7 |
Incorrect |
143 ms |
10596 KB |
wrong parameter |
8 |
Incorrect |
99 ms |
9876 KB |
wrong parameter |
9 |
Incorrect |
92 ms |
10300 KB |
wrong parameter |
10 |
Incorrect |
106 ms |
10324 KB |
wrong parameter |
11 |
Incorrect |
112 ms |
10240 KB |
wrong parameter |
12 |
Incorrect |
106 ms |
10136 KB |
wrong parameter |
13 |
Incorrect |
117 ms |
10872 KB |
wrong parameter |
14 |
Incorrect |
100 ms |
10192 KB |
wrong parameter |
15 |
Incorrect |
93 ms |
10240 KB |
wrong parameter |
16 |
Incorrect |
135 ms |
10660 KB |
wrong parameter |
17 |
Incorrect |
125 ms |
10660 KB |
wrong parameter |
18 |
Incorrect |
115 ms |
10868 KB |
wrong parameter |
19 |
Incorrect |
110 ms |
10476 KB |
wrong parameter |
20 |
Incorrect |
133 ms |
11200 KB |
wrong parameter |
21 |
Incorrect |
146 ms |
11312 KB |
wrong parameter |
22 |
Incorrect |
120 ms |
10808 KB |
wrong parameter |
23 |
Incorrect |
146 ms |
11652 KB |
wrong parameter |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
267 ms |
14668 KB |
wrong parameter |
2 |
Incorrect |
3 ms |
4880 KB |
wrong parameter |
3 |
Incorrect |
92 ms |
9688 KB |
wrong parameter |
4 |
Correct |
4 ms |
4848 KB |
Output is correct - 100 call(s) of encode_bit() |
5 |
Incorrect |
88 ms |
9812 KB |
wrong parameter |
6 |
Incorrect |
112 ms |
10236 KB |
wrong parameter |
7 |
Incorrect |
143 ms |
10596 KB |
wrong parameter |
8 |
Incorrect |
99 ms |
9876 KB |
wrong parameter |
9 |
Incorrect |
92 ms |
10300 KB |
wrong parameter |
10 |
Incorrect |
106 ms |
10324 KB |
wrong parameter |
11 |
Incorrect |
112 ms |
10240 KB |
wrong parameter |
12 |
Incorrect |
106 ms |
10136 KB |
wrong parameter |
13 |
Incorrect |
117 ms |
10872 KB |
wrong parameter |
14 |
Incorrect |
100 ms |
10192 KB |
wrong parameter |
15 |
Incorrect |
93 ms |
10240 KB |
wrong parameter |
16 |
Incorrect |
135 ms |
10660 KB |
wrong parameter |
17 |
Incorrect |
125 ms |
10660 KB |
wrong parameter |
18 |
Incorrect |
115 ms |
10868 KB |
wrong parameter |
19 |
Incorrect |
110 ms |
10476 KB |
wrong parameter |
20 |
Incorrect |
133 ms |
11200 KB |
wrong parameter |
21 |
Incorrect |
146 ms |
11312 KB |
wrong parameter |
22 |
Incorrect |
120 ms |
10808 KB |
wrong parameter |
23 |
Incorrect |
146 ms |
11652 KB |
wrong parameter |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
267 ms |
14668 KB |
wrong parameter |
2 |
Incorrect |
3 ms |
4880 KB |
wrong parameter |
3 |
Incorrect |
92 ms |
9688 KB |
wrong parameter |
4 |
Correct |
4 ms |
4848 KB |
Output is correct - 100 call(s) of encode_bit() |
5 |
Incorrect |
88 ms |
9812 KB |
wrong parameter |
6 |
Incorrect |
112 ms |
10236 KB |
wrong parameter |
7 |
Incorrect |
143 ms |
10596 KB |
wrong parameter |
8 |
Incorrect |
99 ms |
9876 KB |
wrong parameter |
9 |
Incorrect |
92 ms |
10300 KB |
wrong parameter |
10 |
Incorrect |
106 ms |
10324 KB |
wrong parameter |
11 |
Incorrect |
112 ms |
10240 KB |
wrong parameter |
12 |
Incorrect |
106 ms |
10136 KB |
wrong parameter |
13 |
Incorrect |
117 ms |
10872 KB |
wrong parameter |
14 |
Incorrect |
100 ms |
10192 KB |
wrong parameter |
15 |
Incorrect |
93 ms |
10240 KB |
wrong parameter |
16 |
Incorrect |
135 ms |
10660 KB |
wrong parameter |
17 |
Incorrect |
125 ms |
10660 KB |
wrong parameter |
18 |
Incorrect |
115 ms |
10868 KB |
wrong parameter |
19 |
Incorrect |
110 ms |
10476 KB |
wrong parameter |
20 |
Incorrect |
133 ms |
11200 KB |
wrong parameter |
21 |
Incorrect |
146 ms |
11312 KB |
wrong parameter |
22 |
Incorrect |
120 ms |
10808 KB |
wrong parameter |
23 |
Incorrect |
146 ms |
11652 KB |
wrong parameter |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
267 ms |
14668 KB |
wrong parameter |
2 |
Incorrect |
3 ms |
4880 KB |
wrong parameter |
3 |
Incorrect |
92 ms |
9688 KB |
wrong parameter |
4 |
Correct |
4 ms |
4848 KB |
Output is correct - 100 call(s) of encode_bit() |
5 |
Incorrect |
88 ms |
9812 KB |
wrong parameter |
6 |
Incorrect |
112 ms |
10236 KB |
wrong parameter |
7 |
Incorrect |
143 ms |
10596 KB |
wrong parameter |
8 |
Incorrect |
99 ms |
9876 KB |
wrong parameter |
9 |
Incorrect |
92 ms |
10300 KB |
wrong parameter |
10 |
Incorrect |
106 ms |
10324 KB |
wrong parameter |
11 |
Incorrect |
112 ms |
10240 KB |
wrong parameter |
12 |
Incorrect |
106 ms |
10136 KB |
wrong parameter |
13 |
Incorrect |
117 ms |
10872 KB |
wrong parameter |
14 |
Incorrect |
100 ms |
10192 KB |
wrong parameter |
15 |
Incorrect |
93 ms |
10240 KB |
wrong parameter |
16 |
Incorrect |
135 ms |
10660 KB |
wrong parameter |
17 |
Incorrect |
125 ms |
10660 KB |
wrong parameter |
18 |
Incorrect |
115 ms |
10868 KB |
wrong parameter |
19 |
Incorrect |
110 ms |
10476 KB |
wrong parameter |
20 |
Incorrect |
133 ms |
11200 KB |
wrong parameter |
21 |
Incorrect |
146 ms |
11312 KB |
wrong parameter |
22 |
Incorrect |
120 ms |
10808 KB |
wrong parameter |
23 |
Incorrect |
146 ms |
11652 KB |
wrong parameter |