///~~~LOTA~~~///
#include "grader.h"
#include <bits/stdc++.h>
using namespace std;
#define N 1000
void encode(int n,int m,int p,int a[],int b[]){
int o;
int d[m][n];
bool vis[n];
vector<int> e[n];
for(int i=0;i<p;i++){
e[a[i]].push_back(b[i]);
e[b[i]].push_back(a[i]);
}
for(int i=0;i<m;i++){
for(int j=o=0;j<n;j++)
vis[j]=1;
vis[i]=0;
vector<int> u,v{i};
while(!v.empty()){
for(auto& j:v){
d[i][j]=o;
for(auto& k:e[j]){
if(vis[k])
u.push_back(k);
vis[k]=0;
}
}
o++;
v=u;
u.clear();
}
}
for(int i=0;i<m;i++){
for(int j=0;j<n;j++){
for(int k=512;k>0;k/=2){
if(d[i][j]>=k){
encode_bit(1);
d[i][j]-=k;
}
else encode_bit(0);
}
}
}
}
///~~~LOTA~~~///
#include "grader.h"
#include <bits/stdc++.h>
using namespace std;
void decode(int n,int m){
int o;
for(int i=0;i<m;i++){
for(int j=0;j<n;j++){
o=0;
for(int k=512;k>0;k/=2){
if(decode_bit()) o+=k;
}
hops(i,j,o);
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
191 ms |
20492 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
2 ms |
11268 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
49 ms |
15500 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
2 ms |
11264 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
51 ms |
15860 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
61 ms |
15644 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
70 ms |
15892 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
54 ms |
15608 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
55 ms |
15748 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
54 ms |
15724 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
59 ms |
15844 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
60 ms |
15644 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
83 ms |
15968 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
63 ms |
15640 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
55 ms |
15560 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
74 ms |
16308 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
69 ms |
16508 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
83 ms |
16500 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
65 ms |
15752 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
84 ms |
18452 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
93 ms |
18808 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
73 ms |
16268 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
92 ms |
18784 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
191 ms |
20492 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
2 ms |
11268 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
49 ms |
15500 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
2 ms |
11264 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
51 ms |
15860 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
61 ms |
15644 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
70 ms |
15892 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
54 ms |
15608 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
55 ms |
15748 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
54 ms |
15724 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
59 ms |
15844 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
60 ms |
15644 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
83 ms |
15968 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
63 ms |
15640 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
55 ms |
15560 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
74 ms |
16308 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
69 ms |
16508 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
83 ms |
16500 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
65 ms |
15752 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
84 ms |
18452 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
93 ms |
18808 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
73 ms |
16268 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
92 ms |
18784 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
191 ms |
20492 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
2 ms |
11268 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
49 ms |
15500 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
2 ms |
11264 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
51 ms |
15860 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
61 ms |
15644 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
70 ms |
15892 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
54 ms |
15608 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
55 ms |
15748 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
54 ms |
15724 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
59 ms |
15844 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
60 ms |
15644 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
83 ms |
15968 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
63 ms |
15640 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
55 ms |
15560 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
74 ms |
16308 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
69 ms |
16508 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
83 ms |
16500 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
65 ms |
15752 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
84 ms |
18452 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
93 ms |
18808 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
73 ms |
16268 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
92 ms |
18784 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
191 ms |
20492 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
2 ms |
11268 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
49 ms |
15500 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
2 ms |
11264 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
51 ms |
15860 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
61 ms |
15644 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
70 ms |
15892 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
54 ms |
15608 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
55 ms |
15748 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
54 ms |
15724 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
59 ms |
15844 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
60 ms |
15644 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
83 ms |
15968 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
63 ms |
15640 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
55 ms |
15560 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
74 ms |
16308 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
69 ms |
16508 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
83 ms |
16500 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
65 ms |
15752 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
84 ms |
18452 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
93 ms |
18808 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
73 ms |
16268 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
92 ms |
18784 KB |
Output is partially correct - 360000 call(s) of encode_bit() |