#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]);
}
pair<int,int>d[N];
for(int i=0;i<H;i++){
for(int j=0;j<N;j++){
d[i]={-1,j};
}
queue<int>q;
d[i].ff=0;
q.push(i);
while(!q.empty()){
int x=q.front();
q.pop();
for(auto y:adj[x]){
if(d[y].ff==-1){
d[y].ff=d[x].ff+1;
q.push(y);
}
}
}
sort(d,d+N);
for(int j=1;j<N;j++){
if(d[j].ff==d[j-1].ff){
encode_bit(0);
}
else{
encode_bit(1);
}
for(int k=0;k<10;k++){
encode_bit(d[j].ss%2);
d[j].ss/=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++){
hops(i,i,0);
int dist=0;
for(int j=1;j<N;j++){
int city=0;
for(int k=0;k<10;k++){
city+=decode_bit()*(1<<k);
}
hops(i,city,dist);
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
172 ms |
12724 KB |
duplicate hops call |
2 |
Incorrect |
2 ms |
4572 KB |
duplicate hops call |
3 |
Incorrect |
50 ms |
7588 KB |
duplicate hops call |
4 |
Incorrect |
1 ms |
4600 KB |
duplicate hops call |
5 |
Incorrect |
52 ms |
7752 KB |
duplicate hops call |
6 |
Incorrect |
58 ms |
8056 KB |
duplicate hops call |
7 |
Incorrect |
77 ms |
8348 KB |
duplicate hops call |
8 |
Incorrect |
60 ms |
7772 KB |
duplicate hops call |
9 |
Incorrect |
62 ms |
7796 KB |
duplicate hops call |
10 |
Incorrect |
65 ms |
7868 KB |
duplicate hops call |
11 |
Incorrect |
67 ms |
8028 KB |
duplicate hops call |
12 |
Incorrect |
64 ms |
7796 KB |
duplicate hops call |
13 |
Incorrect |
83 ms |
8472 KB |
duplicate hops call |
14 |
Incorrect |
56 ms |
7856 KB |
duplicate hops call |
15 |
Incorrect |
59 ms |
7864 KB |
duplicate hops call |
16 |
Incorrect |
99 ms |
8224 KB |
duplicate hops call |
17 |
Incorrect |
77 ms |
8328 KB |
duplicate hops call |
18 |
Incorrect |
82 ms |
8616 KB |
duplicate hops call |
19 |
Incorrect |
71 ms |
8168 KB |
duplicate hops call |
20 |
Incorrect |
80 ms |
8840 KB |
duplicate hops call |
21 |
Incorrect |
83 ms |
9008 KB |
duplicate hops call |
22 |
Incorrect |
83 ms |
8544 KB |
duplicate hops call |
23 |
Incorrect |
108 ms |
9256 KB |
duplicate hops call |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
172 ms |
12724 KB |
duplicate hops call |
2 |
Incorrect |
2 ms |
4572 KB |
duplicate hops call |
3 |
Incorrect |
50 ms |
7588 KB |
duplicate hops call |
4 |
Incorrect |
1 ms |
4600 KB |
duplicate hops call |
5 |
Incorrect |
52 ms |
7752 KB |
duplicate hops call |
6 |
Incorrect |
58 ms |
8056 KB |
duplicate hops call |
7 |
Incorrect |
77 ms |
8348 KB |
duplicate hops call |
8 |
Incorrect |
60 ms |
7772 KB |
duplicate hops call |
9 |
Incorrect |
62 ms |
7796 KB |
duplicate hops call |
10 |
Incorrect |
65 ms |
7868 KB |
duplicate hops call |
11 |
Incorrect |
67 ms |
8028 KB |
duplicate hops call |
12 |
Incorrect |
64 ms |
7796 KB |
duplicate hops call |
13 |
Incorrect |
83 ms |
8472 KB |
duplicate hops call |
14 |
Incorrect |
56 ms |
7856 KB |
duplicate hops call |
15 |
Incorrect |
59 ms |
7864 KB |
duplicate hops call |
16 |
Incorrect |
99 ms |
8224 KB |
duplicate hops call |
17 |
Incorrect |
77 ms |
8328 KB |
duplicate hops call |
18 |
Incorrect |
82 ms |
8616 KB |
duplicate hops call |
19 |
Incorrect |
71 ms |
8168 KB |
duplicate hops call |
20 |
Incorrect |
80 ms |
8840 KB |
duplicate hops call |
21 |
Incorrect |
83 ms |
9008 KB |
duplicate hops call |
22 |
Incorrect |
83 ms |
8544 KB |
duplicate hops call |
23 |
Incorrect |
108 ms |
9256 KB |
duplicate hops call |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
172 ms |
12724 KB |
duplicate hops call |
2 |
Incorrect |
2 ms |
4572 KB |
duplicate hops call |
3 |
Incorrect |
50 ms |
7588 KB |
duplicate hops call |
4 |
Incorrect |
1 ms |
4600 KB |
duplicate hops call |
5 |
Incorrect |
52 ms |
7752 KB |
duplicate hops call |
6 |
Incorrect |
58 ms |
8056 KB |
duplicate hops call |
7 |
Incorrect |
77 ms |
8348 KB |
duplicate hops call |
8 |
Incorrect |
60 ms |
7772 KB |
duplicate hops call |
9 |
Incorrect |
62 ms |
7796 KB |
duplicate hops call |
10 |
Incorrect |
65 ms |
7868 KB |
duplicate hops call |
11 |
Incorrect |
67 ms |
8028 KB |
duplicate hops call |
12 |
Incorrect |
64 ms |
7796 KB |
duplicate hops call |
13 |
Incorrect |
83 ms |
8472 KB |
duplicate hops call |
14 |
Incorrect |
56 ms |
7856 KB |
duplicate hops call |
15 |
Incorrect |
59 ms |
7864 KB |
duplicate hops call |
16 |
Incorrect |
99 ms |
8224 KB |
duplicate hops call |
17 |
Incorrect |
77 ms |
8328 KB |
duplicate hops call |
18 |
Incorrect |
82 ms |
8616 KB |
duplicate hops call |
19 |
Incorrect |
71 ms |
8168 KB |
duplicate hops call |
20 |
Incorrect |
80 ms |
8840 KB |
duplicate hops call |
21 |
Incorrect |
83 ms |
9008 KB |
duplicate hops call |
22 |
Incorrect |
83 ms |
8544 KB |
duplicate hops call |
23 |
Incorrect |
108 ms |
9256 KB |
duplicate hops call |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
172 ms |
12724 KB |
duplicate hops call |
2 |
Incorrect |
2 ms |
4572 KB |
duplicate hops call |
3 |
Incorrect |
50 ms |
7588 KB |
duplicate hops call |
4 |
Incorrect |
1 ms |
4600 KB |
duplicate hops call |
5 |
Incorrect |
52 ms |
7752 KB |
duplicate hops call |
6 |
Incorrect |
58 ms |
8056 KB |
duplicate hops call |
7 |
Incorrect |
77 ms |
8348 KB |
duplicate hops call |
8 |
Incorrect |
60 ms |
7772 KB |
duplicate hops call |
9 |
Incorrect |
62 ms |
7796 KB |
duplicate hops call |
10 |
Incorrect |
65 ms |
7868 KB |
duplicate hops call |
11 |
Incorrect |
67 ms |
8028 KB |
duplicate hops call |
12 |
Incorrect |
64 ms |
7796 KB |
duplicate hops call |
13 |
Incorrect |
83 ms |
8472 KB |
duplicate hops call |
14 |
Incorrect |
56 ms |
7856 KB |
duplicate hops call |
15 |
Incorrect |
59 ms |
7864 KB |
duplicate hops call |
16 |
Incorrect |
99 ms |
8224 KB |
duplicate hops call |
17 |
Incorrect |
77 ms |
8328 KB |
duplicate hops call |
18 |
Incorrect |
82 ms |
8616 KB |
duplicate hops call |
19 |
Incorrect |
71 ms |
8168 KB |
duplicate hops call |
20 |
Incorrect |
80 ms |
8840 KB |
duplicate hops call |
21 |
Incorrect |
83 ms |
9008 KB |
duplicate hops call |
22 |
Incorrect |
83 ms |
8544 KB |
duplicate hops call |
23 |
Incorrect |
108 ms |
9256 KB |
duplicate hops call |