#include <bits/stdc++.h>
#include "encoder.h"
#include "grader.h"
#define ii pair<int, int>
using namespace std;
void encode(int nv, int nh, int ne, int *v1, int *v2){
vector<int> adj[1001];
for(int i = 0; i < ne; i++){
adj[v1[i]].push_back(v2[i]);
adj[v2[i]].push_back(v1[i]);
}
int dist[36][1001];
bool vis[1001];
for(int i = 0; i < nh; i++){
memset(vis, 0, sizeof vis);
queue<ii> q;
q.push({i, 0}); vis[i] = true;
while(!q.empty()){
auto [n, w] = q.front();
q.pop();
dist[i][n] = w;
for(auto x : adj[n]){
if(vis[x]) continue;
vis[x] = true;
q.push({x, w + 1});
}
}
}
for(int i = 0; i < nh; i++){
for(int j = 0; j < nv; j++){
for(int k = 0; k < 10; k++){
if(dist[i][j] & (1 << k)) encode_bit(1);
else encode_bit(0);
}
}
}
return;
}
#include <bits/stdc++.h>
#include "decoder.h"
#include "grader.h"
#define ii pair<int, int>
using namespace std;
void decode(int nv, int nh) {
for(int i = 0; i < nh; i++){
for(int j = 0; j < nv; j++){
int ans = 0;
for(int k = 0; k < 10; k++){
if(decode_bit()) ans += (1 << k);
}
hops(i, j, ans);
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
336 ms |
12520 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
2 ms |
4732 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
63 ms |
7452 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
3 ms |
4732 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
63 ms |
7620 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
69 ms |
7840 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
83 ms |
8228 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
75 ms |
7552 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
70 ms |
7840 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
72 ms |
7716 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
80 ms |
7832 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
81 ms |
7576 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
101 ms |
8276 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
80 ms |
7800 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
78 ms |
7824 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
100 ms |
8164 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
95 ms |
8212 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
90 ms |
8472 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
80 ms |
8008 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
118 ms |
8716 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
104 ms |
8864 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
110 ms |
8304 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
111 ms |
9040 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
336 ms |
12520 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
2 ms |
4732 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
63 ms |
7452 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
3 ms |
4732 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
63 ms |
7620 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
69 ms |
7840 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
83 ms |
8228 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
75 ms |
7552 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
70 ms |
7840 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
72 ms |
7716 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
80 ms |
7832 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
81 ms |
7576 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
101 ms |
8276 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
80 ms |
7800 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
78 ms |
7824 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
100 ms |
8164 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
95 ms |
8212 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
90 ms |
8472 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
80 ms |
8008 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
118 ms |
8716 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
104 ms |
8864 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
110 ms |
8304 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
111 ms |
9040 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
336 ms |
12520 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
2 ms |
4732 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
63 ms |
7452 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
3 ms |
4732 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
63 ms |
7620 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
69 ms |
7840 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
83 ms |
8228 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
75 ms |
7552 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
70 ms |
7840 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
72 ms |
7716 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
80 ms |
7832 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
81 ms |
7576 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
101 ms |
8276 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
80 ms |
7800 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
78 ms |
7824 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
100 ms |
8164 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
95 ms |
8212 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
90 ms |
8472 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
80 ms |
8008 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
118 ms |
8716 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
104 ms |
8864 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
110 ms |
8304 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
111 ms |
9040 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
336 ms |
12520 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
2 ms |
4732 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
63 ms |
7452 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
3 ms |
4732 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
63 ms |
7620 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
69 ms |
7840 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
83 ms |
8228 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
75 ms |
7552 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
70 ms |
7840 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
72 ms |
7716 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
80 ms |
7832 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
81 ms |
7576 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
101 ms |
8276 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
80 ms |
7800 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
78 ms |
7824 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
100 ms |
8164 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
95 ms |
8212 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
90 ms |
8472 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
80 ms |
8008 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
118 ms |
8716 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
104 ms |
8864 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
110 ms |
8304 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
111 ms |
9040 KB |
Output is partially correct - 360000 call(s) of encode_bit() |