#include<bits/stdc++.h>
#include "grader.h"
#include "encoder.h"
using namespace std;
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define all(s) s.begin(),s.end()
void encode(int N,int H,int P,int *A,int *B){
vector<int>adj[N];
for(int i=0;i<P;i++){
adj[A[i]].pb(B[i]);
adj[B[i]].pb(A[i]);
}
int d[N];
for(int i=0;i<H;i++){
fill(d,d+N,-1);
queue<int>q;
d[i]=0;
q.push(i);
while(!q.empty()){
int x=q.front();
q.pop();
for(auto y:adj[x]){
if(d[y]==-1){
d[y]=d[x]+1;
q.push(y);
}
}
}
for(int j=0;j<N;j++){
for(int k=0;k<10;k++){
encode_bit(d[j]%2);
d[j]/=2;
}
}
}
}
#include<bits/stdc++.h>
#include "grader.h"
#include "decoder.h"
using namespace std;
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define all(s) s.begin(),s.end()
void decode(int N,int H){
for(int i=0;i<H;i++){
for(int j=0;j<N;j++){
int ans=0;
for(int k=0;k<10;k++){
ans+=decode_bit()*(1<<k);
}
hops(i,j,ans);
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
257 ms |
12420 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
3 ms |
4476 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
50 ms |
7316 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
2 ms |
4604 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
53 ms |
7560 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
65 ms |
7716 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
70 ms |
8036 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
51 ms |
7272 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
55 ms |
7488 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
66 ms |
7464 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
56 ms |
7776 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
66 ms |
7504 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
79 ms |
8092 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
56 ms |
7580 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
66 ms |
7616 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
69 ms |
8088 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
73 ms |
8084 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
78 ms |
8360 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
63 ms |
7788 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
88 ms |
8564 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
84 ms |
8736 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
71 ms |
8364 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
113 ms |
8852 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
257 ms |
12420 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
3 ms |
4476 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
50 ms |
7316 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
2 ms |
4604 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
53 ms |
7560 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
65 ms |
7716 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
70 ms |
8036 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
51 ms |
7272 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
55 ms |
7488 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
66 ms |
7464 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
56 ms |
7776 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
66 ms |
7504 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
79 ms |
8092 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
56 ms |
7580 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
66 ms |
7616 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
69 ms |
8088 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
73 ms |
8084 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
78 ms |
8360 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
63 ms |
7788 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
88 ms |
8564 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
84 ms |
8736 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
71 ms |
8364 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
113 ms |
8852 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
257 ms |
12420 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
3 ms |
4476 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
50 ms |
7316 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
2 ms |
4604 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
53 ms |
7560 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
65 ms |
7716 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
70 ms |
8036 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
51 ms |
7272 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
55 ms |
7488 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
66 ms |
7464 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
56 ms |
7776 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
66 ms |
7504 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
79 ms |
8092 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
56 ms |
7580 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
66 ms |
7616 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
69 ms |
8088 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
73 ms |
8084 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
78 ms |
8360 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
63 ms |
7788 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
88 ms |
8564 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
84 ms |
8736 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
71 ms |
8364 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
113 ms |
8852 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
257 ms |
12420 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
3 ms |
4476 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
50 ms |
7316 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
2 ms |
4604 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
53 ms |
7560 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
65 ms |
7716 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
70 ms |
8036 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
51 ms |
7272 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
55 ms |
7488 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
66 ms |
7464 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
56 ms |
7776 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
66 ms |
7504 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
79 ms |
8092 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
56 ms |
7580 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
66 ms |
7616 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
69 ms |
8088 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
73 ms |
8084 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
78 ms |
8360 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
63 ms |
7788 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
88 ms |
8564 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
84 ms |
8736 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
71 ms |
8364 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
113 ms |
8852 KB |
Output is partially correct - 360000 call(s) of encode_bit() |