#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[]){
srand(time(NULL));
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]);
}
priority_queue<pair<int,pair<int,int>>>pq;
map<pair<int,int>,bool>mp;
for(int i=0;i<h;i++){
deque<pair<int,int>>dq={{0,i}};
vector<bool>vis(n);
while(dq.size()){
pair<int,int>p=dq.front();
dq.pop_front();
for(auto &w:vct[p.second]){
if(vis[w])continue;
vis[w]=1;
if(!mp[{min(w,p.second),max(w,p.second)}]){
pq.push({rand(),{min(w,p.second),max(w,p.second)}});
mp[{min(w,p.second),max(w,p.second)}]=1;
}
dq.push_back({p.first+1,w});
}
}
}
int tot=360000/20;
while(tot--){
pair<int,int>pr;
if(pq.empty())pr={0,0};
else{
pr=pq.top().second;
pq.pop();
}
for(int i=0;i<10;i++)encode_bit((!!(pr.first&(1<<i))));
for(int i=0;i<10;i++)encode_bit((!!(pr.second&(1<<i))));
}
}
#include "grader.h"
#include "decoder.h"
#include <bits/stdc++.h>
using namespace std;
void decode(int n, int h) {
vector<int>vct[n];
for(int i=0;i<360000/20;i++){
int a=0,b=0;
for(int w=0;w<10;w++)a+=(1<<w)*decode_bit();
for(int w=0;w<10;w++)b+=(1<<w)*decode_bit();
vct[a].push_back(b);
vct[b].push_back(a);
}
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();
hops(i,p.second,p.first);
for(auto &w:vct[p.second]){if(!vis[w]){dq.push_back({p.first+1,w});vis[w]=1;}}
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
260 ms |
13672 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
55 ms |
7792 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
3 |
Correct |
92 ms |
8108 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
4 |
Correct |
56 ms |
7748 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
5 |
Correct |
79 ms |
8744 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
6 |
Correct |
93 ms |
8788 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Incorrect |
96 ms |
9608 KB |
Output isn't correct |
8 |
Correct |
68 ms |
8060 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
9 |
Correct |
67 ms |
7940 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
73 ms |
7976 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
88 ms |
8244 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
68 ms |
7952 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
107 ms |
9452 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
70 ms |
8012 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
73 ms |
8016 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
92 ms |
8688 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
86 ms |
8668 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
104 ms |
9240 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
83 ms |
8948 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
105 ms |
9512 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
117 ms |
9792 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
105 ms |
9676 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
126 ms |
10212 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
260 ms |
13672 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
55 ms |
7792 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
3 |
Correct |
92 ms |
8108 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
4 |
Correct |
56 ms |
7748 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
5 |
Correct |
79 ms |
8744 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
6 |
Correct |
93 ms |
8788 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Incorrect |
96 ms |
9608 KB |
Output isn't correct |
8 |
Correct |
68 ms |
8060 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
9 |
Correct |
67 ms |
7940 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
73 ms |
7976 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
88 ms |
8244 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
68 ms |
7952 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
107 ms |
9452 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
70 ms |
8012 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
73 ms |
8016 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
92 ms |
8688 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
86 ms |
8668 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
104 ms |
9240 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
83 ms |
8948 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
105 ms |
9512 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
117 ms |
9792 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
105 ms |
9676 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
126 ms |
10212 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
260 ms |
13672 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
55 ms |
7792 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
3 |
Correct |
92 ms |
8108 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
4 |
Correct |
56 ms |
7748 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
5 |
Correct |
79 ms |
8744 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
6 |
Correct |
93 ms |
8788 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Incorrect |
96 ms |
9608 KB |
Output isn't correct |
8 |
Correct |
68 ms |
8060 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
9 |
Correct |
67 ms |
7940 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
73 ms |
7976 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
88 ms |
8244 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
68 ms |
7952 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
107 ms |
9452 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
70 ms |
8012 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
73 ms |
8016 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
92 ms |
8688 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
86 ms |
8668 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
104 ms |
9240 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
83 ms |
8948 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
105 ms |
9512 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
117 ms |
9792 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
105 ms |
9676 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
126 ms |
10212 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
260 ms |
13672 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
55 ms |
7792 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
3 |
Correct |
92 ms |
8108 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
4 |
Correct |
56 ms |
7748 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
5 |
Correct |
79 ms |
8744 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
6 |
Correct |
93 ms |
8788 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Incorrect |
96 ms |
9608 KB |
Output isn't correct |
8 |
Correct |
68 ms |
8060 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
9 |
Correct |
67 ms |
7940 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
73 ms |
7976 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
88 ms |
8244 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
68 ms |
7952 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
107 ms |
9452 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
70 ms |
8012 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
73 ms |
8016 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
92 ms |
8688 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
86 ms |
8668 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
104 ms |
9240 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
83 ms |
8948 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
105 ms |
9512 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
117 ms |
9792 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
105 ms |
9676 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
126 ms |
10212 KB |
Output is partially correct - 360000 call(s) of encode_bit() |