#include "grader.h"
#include "encoder.h"
#include <bits/stdc++.h>
using namespace std;
void encode(int n, int h, int p, int v1[], int v2[]){
vector<int>vct[n];
for(int i=0;i<p;i++){
vct[v1[i]].push_back(v2[i]);
vct[v2[i]].push_back(v1[i]);
}
int arr[h][n];
for(int i=0;i<h;i++){
deque<pair<int,int>>dq={{0,i}};
vector<bool>vis(n);
vis[i]=1;
while(dq.size()){
pair<int,int>p=dq.front();
dq.pop_front();
arr[i][p.second]=p.first;
for(auto &w:vct[p.second]){if(!vis[w]){dq.push_back({p.first+1,w});vis[w]=1;}}
}
}
for(int i=0;i<h;i++){
for(int w=0;w<n;w++){
for(int j=0;j<10;j++){
if(arr[i][w]&(1<<j))encode_bit(1);
else encode_bit(0);
}
}
}
}
#include "grader.h"
#include "decoder.h"
#include <bits/stdc++.h>
using namespace std;
void decode(int n, int h) {
for(int i=0;i<h;i++){
for(int w=0;w<n;w++){
int f=0;
for(int j=0;j<10;j++){
if(decode_bit())f+=(1<<j);
}
hops(i,w,f);
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
261 ms |
12452 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
2 ms |
4612 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
71 ms |
7416 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
3 ms |
4604 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
77 ms |
7600 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
84 ms |
7852 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
90 ms |
8240 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
75 ms |
7596 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
73 ms |
7812 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
93 ms |
7732 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
73 ms |
7844 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
76 ms |
7680 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
94 ms |
8280 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
82 ms |
7784 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
73 ms |
7708 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
92 ms |
8220 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
105 ms |
8160 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
104 ms |
8424 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
81 ms |
8124 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
108 ms |
8736 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
108 ms |
8884 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
94 ms |
8400 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
117 ms |
9136 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
261 ms |
12452 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
2 ms |
4612 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
71 ms |
7416 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
3 ms |
4604 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
77 ms |
7600 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
84 ms |
7852 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
90 ms |
8240 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
75 ms |
7596 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
73 ms |
7812 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
93 ms |
7732 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
73 ms |
7844 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
76 ms |
7680 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
94 ms |
8280 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
82 ms |
7784 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
73 ms |
7708 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
92 ms |
8220 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
105 ms |
8160 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
104 ms |
8424 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
81 ms |
8124 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
108 ms |
8736 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
108 ms |
8884 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
94 ms |
8400 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
117 ms |
9136 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
261 ms |
12452 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
2 ms |
4612 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
71 ms |
7416 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
3 ms |
4604 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
77 ms |
7600 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
84 ms |
7852 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
90 ms |
8240 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
75 ms |
7596 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
73 ms |
7812 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
93 ms |
7732 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
73 ms |
7844 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
76 ms |
7680 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
94 ms |
8280 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
82 ms |
7784 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
73 ms |
7708 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
92 ms |
8220 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
105 ms |
8160 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
104 ms |
8424 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
81 ms |
8124 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
108 ms |
8736 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
108 ms |
8884 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
94 ms |
8400 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
117 ms |
9136 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
261 ms |
12452 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
2 ms |
4612 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
71 ms |
7416 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
3 ms |
4604 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
77 ms |
7600 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
84 ms |
7852 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
90 ms |
8240 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
75 ms |
7596 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
73 ms |
7812 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
93 ms |
7732 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
73 ms |
7844 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
76 ms |
7680 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
94 ms |
8280 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
82 ms |
7784 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
73 ms |
7708 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
92 ms |
8220 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
105 ms |
8160 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
104 ms |
8424 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
81 ms |
8124 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
108 ms |
8736 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
108 ms |
8884 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
94 ms |
8400 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
117 ms |
9136 KB |
Output is partially correct - 360000 call(s) of encode_bit() |