#include <bits/stdc++.h>
#include "grader.h"
#include "encoder.h"
using namespace std;
namespace{
int n, k, m;
vector<int> link[1002];
int dist[40][1002];
void bfs(int h){
bool visited[1002] = {0};
queue<pair<int, int> > que;
que.push({h, 0});
visited[h] = 1;
while(!que.empty()){
pair<int, int> tmp = que.front();
int x = tmp.first, d = tmp.second;
que.pop();
for(auto &y: link[x]){
if(visited[y]) continue;
visited[y] = 1;
dist[h][y] = d+1;
que.push({y, d+1});
}
}
}
}
void encode(int N, int K, int M, int *U, int *V){
n = N, k = K, m = M;
for(int i=0; i<m; i++){
link[U[i]].push_back(V[i]);
link[V[i]].push_back(U[i]);
}
for(int x=0; x<k; x++){
bfs(x);
for(int i=0; i<n; i++){
for(int j=0; j<10; j++){
encode_bit(!!(dist[x][i] & (1<<j)));
}
}
}
}
#include <bits/stdc++.h>
#include "grader.h"
#include "decoder.h"
using namespace std;
namespace{
int n, k;
}
void decode(int N, int K){
n = N, k = K;
for(int x=0; x<k; x++){
for(int i=0; i<n; i++){
int tmp = 0;
for(int j=0; j<10; j++){
tmp += (1<<j) * decode_bit();
}
hops(x, i, tmp);
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
335 ms |
13808 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
4 ms |
4736 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
94 ms |
7680 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
4 ms |
4736 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
99 ms |
7888 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
118 ms |
7928 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
122 ms |
8312 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
111 ms |
7672 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
111 ms |
8048 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
106 ms |
8048 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
135 ms |
8092 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
128 ms |
7920 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
151 ms |
8560 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
118 ms |
7968 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
106 ms |
8000 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
165 ms |
8512 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
123 ms |
8456 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
136 ms |
8760 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
124 ms |
8340 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
162 ms |
8944 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
194 ms |
9140 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
150 ms |
8724 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
165 ms |
9208 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
335 ms |
13808 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
4 ms |
4736 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
94 ms |
7680 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
4 ms |
4736 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
99 ms |
7888 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
118 ms |
7928 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
122 ms |
8312 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
111 ms |
7672 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
111 ms |
8048 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
106 ms |
8048 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
135 ms |
8092 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
128 ms |
7920 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
151 ms |
8560 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
118 ms |
7968 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
106 ms |
8000 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
165 ms |
8512 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
123 ms |
8456 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
136 ms |
8760 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
124 ms |
8340 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
162 ms |
8944 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
194 ms |
9140 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
150 ms |
8724 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
165 ms |
9208 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
335 ms |
13808 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
4 ms |
4736 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
94 ms |
7680 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
4 ms |
4736 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
99 ms |
7888 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
118 ms |
7928 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
122 ms |
8312 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
111 ms |
7672 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
111 ms |
8048 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
106 ms |
8048 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
135 ms |
8092 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
128 ms |
7920 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
151 ms |
8560 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
118 ms |
7968 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
106 ms |
8000 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
165 ms |
8512 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
123 ms |
8456 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
136 ms |
8760 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
124 ms |
8340 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
162 ms |
8944 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
194 ms |
9140 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
150 ms |
8724 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
165 ms |
9208 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
335 ms |
13808 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
4 ms |
4736 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
94 ms |
7680 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
4 ms |
4736 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
99 ms |
7888 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
118 ms |
7928 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
122 ms |
8312 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
111 ms |
7672 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
111 ms |
8048 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
106 ms |
8048 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
135 ms |
8092 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
128 ms |
7920 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
151 ms |
8560 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
118 ms |
7968 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
106 ms |
8000 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
165 ms |
8512 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
123 ms |
8456 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
136 ms |
8760 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
124 ms |
8340 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
162 ms |
8944 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
194 ms |
9140 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
150 ms |
8724 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
165 ms |
9208 KB |
Output is partially correct - 360000 call(s) of encode_bit() |